Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Lenghen/Shorten polygon using aim constraint

Lenghen/Shorten polygon using aim constraint

Anonymous
Not applicable
535 Views
1 Reply
Message 1 of 2

Lenghen/Shorten polygon using aim constraint

Anonymous
Not applicable

Hoping for some help.  I am trying to lengthen/shorten a thin polygon cylinder as it follows an aim constraint object.  BUT, it cannot rely on keyframing to do the lengthening/shortening.  For example, imagine a polygon cylinder (straw) and at one end it is constrained to aim at a sphere touching that end.  What I am hoping for it to have the cylinder lengthen/shorten so that the end of the straw stays in contact with the sphere as the sphere moves.  I know this can be achieved with keyframes, but, unfortunately for my application, keyframing won't work.  Any thoughts would be appreciated.  

0 Likes
536 Views
1 Reply
Reply (1)
Message 2 of 2

jwlove
Advocate
Advocate

You can measure the distance using the distance tool (or the distanceBetween node).  Then divide that distance by the default distance (using a multiply divide node).  This will give you a scale value you can plug in to your cylinder.

 

If you don't want to scale, you will need a joint at both ends of your cylinder that the end of the cylinder is bound to (at least at the point you want to stretch).  The first one should be at the same location in space as the node that is aimed toward your sphere.  The second joint's translate value (in the channel going the length of the cylinder) should start out as the default distance.  Once you have that, take the distance scale value from above, and use a multiplyDivide (or multDoubleLinear) to multiply the default distance value with the scale value and plug that into the end joint's translate value. Personally, I prefer translation methods since scaling sometimes doesn't quite behave the way you would want...

 

NOTE: this will make the end of the cylinder go to the center of the sphere... if you want it to go exactly to the outside of the sphere, you'll need to subtract out the radius of the sphere from the final translation value...

0 Likes