PDA

View Full Version : Spline Length: Transform Level...


jeef
03-08-2004, 10:42 PM
im trying to get the length of a spline using getSegLengths but the spline has linked-xform adjusting the length of the spline (dummy controlled)... and getSegLengths doesnt appear to interprete the transform level...


This length does not reflect any transform level scaling performed on the shape.


i know it says scaling but im guessing this is why its not working... the measure tool reports the correct lenght... so it must be possible?

is there a function that allows for this that i could use instead?

if it helps at all im actually trying to fake some dangling rope type dynamics... no, i dont want to use reactor, because i want it to be fully dynamic within max viewports.

gloupi
03-15-2004, 11:11 AM
Hi jeef,

i am not sure, but have you can try:
-($.transform.scalepart[1])*(curveLength $)
that won t work if you applied a non uniform scaling.

or

SpLength = 0.0 --- the return value
SpOld = 0.0 --- first point on the spline
Sp = 0.0 --- second point on the spline
SpStep = 1000.0 --- sample, raise it to have nicer value

for i = 1 to SpStep do
(
Sp = PathInterp $ ((i/SpStep) as float)
if i > 10 then
(
SpLength += distance Sp SpOld
)
SpOld = Sp
)


I hope this help,
Bye

jeef
03-15-2004, 08:42 PM
sweet, cheers mano, that first one works a charm, i wont be doing any scaling period.

the second script worked, but was a little inacurate for my needs, increasing the step obviosly helps but i was hopping for spot on... which is what the first one does! :)

so thanks! :beer:

CGTalk Moderation
01-17-2006, 04:00 PM
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.