Notifications
Clear all

[Closed] HELP!! Matching Plane.Length to CurveLength

I feel silly asking such a simple question but I’ve been trying to figure this out for 3 days now and can’t seem to find this anywhere. I know there are tons of references but since I am new to this I don’t know what terminology to look up. I must admit, I am extremely new to MAXScript. Though I have a mild background in coding (barely, lol), I can’t seem to figure out how to link one parameter (if that’s the proper terminology here) to another. Here’s what I’m trying to do:

I want to take a spline, and make the length of a plane always equal to that spline’s length. I am rigging the treads of a tank, and I have point helpers fixed to the plane’s surface via Attachment Constraints, and I have each tank tread linked to its corresponding helper through parent:child linking. Where I am having problems is the only way I can figure out how to always keep the plane’s length equal to the spline’s length is via MAXScript, though I am sure there are better ways out there to do this (if anyone knows any, any help is appreciated!) Here’s what I have so far:

while $Plane.Length != curveLength($Spline) do
(
$Plane.Length = curveLength($Spline)
)

This works great, but I don’t know how to loop this continuously. The while loops runs until the plane length is exactly equal to the spline length, but then it stops (as it’s supposed to). I just have no idea of how to continuously make it update during rigging/animating to constantly keep plane length equal to the spline’s length. (Kind of like rigging something via ‘Wire Paramenters’) If anyone knows how it would be forever appreciated!

2 Replies

Put a script controller on to the plane’s length track in the track view and you can use your curvelength script there. It’ll automatically run each time the frame changes so no need for a while or anything like that.

Thanks so much, works like a dream!