Jump to content

Scale by Absolute Value?(newbie question)


Kronso

Recommended Posts

Hi, I've been learning some procedural modeling, and have run into something probably suuuuper simple, that I can't figure out.  I've been searching through help menus to find an answer but haven't had any luck. Also apologies if I have trouble verbalizing my problem.

What is the easiest way to scale an object on an axis to a specific value?  I have two imported obj's of some arbitrary size.  I'm trying to scale object #1 down, to make room for object #2, based on obj #2's size. Like Obj1.z = Obj1.z-Obj2.z.  I was hoping something like using a transform node and scaling an axis by bbox("../object1",D_ZSIZE)-bbox("../object2",D_ZSIZE) but that doesn't seem to work unless the object was originally exactly 1 in scale? 

I've made some convoluted way of creating a line across the z axis of each object, and measuring that. Then in a wrangle, dividing obj2 size by obj1 size and subtracting that from 1, then plugging it into a transform nodes z scale. It does work, but I was hoping for something a bit easier/quicker moving forward.  

Any help would be super appreciated! This is all still pretty foreign to me, coming from maya.

Thanks!

 

 

Link to comment
Share on other sites

You can squeeze an arbitrary object between two other objects by

  • translating it to the center of the gap: (bbox('../LEFT', D_XMAX) + bbox('../RIGHT', D_XMIN)) / 2
  • temporarily scaling it to unit size: 1 / $SIZEX
  • and scaling it by the size of the gap: abs(bbox('../LEFT', D_XMAX) - bbox('../RIGHT', D_XMIN))

image.png.4a8121c837999ad6312af4ca367cb972.png

Not entirely sure whether this is what you have requested, though.

squeeze_inbetween_objects.hipnc

  • Thanks 1
Link to comment
Share on other sites

Thanks so much Konstantin!  This is exactly what I was looking for. I was getting way over complicated with VEX, when this is way simpler and with less nodes.

 

Super appreciated, that'll help simplify a ton of stuff I've been working on.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...