PDA

View Full Version : Line/Spline Lenght????


Q_B
01-14-2004, 09:50 AM
Greetings!

I've posted this question on the Maya forum, with rather fast and great results. Lets see if i get the same luck here ;)

We already made this setup on Maya and it's already working, but i want to make it in Max too.

We are making a car setup, in wich it follows a path, and the front wheels turn correctly, and besides all the 4 wheels have to roll, depending on the motion of the car.

Now, what i need to know, in order for the math formula to work, is how to determine the lenght of the path, that is, the spline.

Anyone knows how to do it? Is there a property of the line object like lenght or size?

Thanx very much.

Dare
01-14-2004, 10:59 AM
Select the spline, go to the Utilities panel, click Measure and voila :thumbsup:

peekoot
01-14-2004, 11:21 AM
yup... Dare is right... but i think that common way when working with paths is to control the percentage... that way if you scale the path you will retain your animation... length will change but percentage will not...

you'll get percentage property after you apply path constraint to the object...

Q_B
01-15-2004, 09:12 AM
Greetings.

Thanx for the help guys.

But that's not quite the problem. Let's see if i can explain better.

What i need to calculate is, at a given point in the path, the turn angle for the car wheels.

Now, the way to acomplish that is to use the formula:

distance / (2*PI*Wheel_Radius)*360

being the distance the current distance in the path, in units, that is, the total distance * path percentage.

So, i really need to determine, for a given line, its length.

The Measure tool is fine, thanx for the tip, but what i really need is to, in a script/formula, be able to access the line length. I could always measure it and literally put that value in the formula, but that way i'd have to revise it each time the line/path is modified.

Now i know there r ways to get that, i'v been lookin at a script method that applies to shapes, curvelength(), but i just can't make it work!

Any help would be welcome!

Thanx again for the replies and the help, peekot and dare!

Baldrick
01-15-2004, 12:02 PM
More of a MAXScript problem this. You could try something using getSegLengths like this;

lengthArray = getSegLengths <spline> 1 cum: true
length = lengthArray[lengthArray.count]

This is using the cum flag to get the cumluative length of all the segments in your spline. This way the last segment in the array will have the full length of the line. I hope that makes sense - if you're not used to MAXScript this could be a bit confusing.

CGTalk Moderation
01-17-2006, 04:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.