Scale Object To Fit Between Two Other Objects [SOLVED]

   1769   2   1
User Avatar
Member
78 posts
Joined: June 2019
Offline
I have a line that is being randomly stretched and moved around at each end. The line is being resampled to give me a center point to lock a sphere to.

I'd like that sphere to stay centered in the middle of the line and scale to fit the length of the line, as the line stretches and moves around.

I have tried the Match Size SOP, which almost gets me there - Although it doesn't scale the sphere to the bounding box's max size, it seems to make the sphere stay inside the bounding box.

Scene attached.

Any ideas?
Edited by GlennimusPrime - Dec. 1, 2020 15:57:26

Attachments:
Sphere_Center.hipnc (134.9 KB)

User Avatar
Member
8583 posts
Joined: July 2007
Offline
the only thing you need to do to is to plug your line geo into the default sphere SOP, it will automatically create a bounding sphere which for a straight line will sit in the center and touch both end boints

Attachments:
Sphere_Center_fix.hipnc (127.8 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
78 posts
Joined: June 2019
Offline
That was incredibly simple

As a new Houdini student I had been stuck on this for a few hours today!

Thanks for your help!
  • Quick Links