PDA

View Full Version : Maya API Linear Interpolation


gwcahill
05-03-2009, 10:50 PM
I need help being directed to the proper Maya API library function call for linear interpolation. I would like to get an object's coordinates and through the use of linear interpolation, move the object to a new location. (I'm having a hard time searching through the Maya API to find it)

Thanks!

JoshM
05-04-2009, 02:49 PM
I'm not sure if this would be too much of an overkill but you can add a MRampAttribute that would allow a user to control the interpolation. I wasn't able to find like linestep or smoothstep from MEL in the API so I just added a MRampAttribute.

Or you could just us vector math to control the transition:

MVector posA, posB, trans;

trans = (posB - posA)*t + posA;

Where 0 <= t <= 1 and translates from the starting position to the ending position.

HTH,
Josh

gwcahill
05-08-2009, 03:32 AM
Thanks for your help. Worked like a dream!

CGTalk Moderation
05-08-2009, 03:32 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.