PDA

View Full Version : Retrieving rotational speed of an object


Muhneer
03-14-2006, 08:34 AM
For an animation that i am producing i am trying to figure
out how to retrieve the speed of a rotation of a object. For instance i want to
adjust the particle wind on the rotation speed of a fan. Just an example.

I tried this with expression but i am unable to retrieve the rotation speed.
Can someone give me a hint or something on how i need to approach this
or where to start.

thanks in advance.

PEN
03-14-2006, 01:05 PM
You have to have something to compare to so use the at time context for this.


curVal=$.rotation.Z_rotation
oldVal=at time (currentTime - 1) $.rotation.Z_rotation
speedVal=curVal-oldVal

Muhneer
03-14-2006, 01:09 PM
Ok i'll go and try it that way!
Many thanks.

Muhneer
03-14-2006, 07:21 PM
Ok this works really great.

I am encountering only a problem. I have searched on the board
and i was able to find it partly.

The problem is that my animated propellor looks good rotating, but if
i watch the Z rotation i see that it goes from 0 tot 180 and then it does
-180, -179 etc etc until its 0 again. I have read about this and that it has to
do with the way 3ds max calculates its rotation. But i am unable to solve this yet.

When i calculate the speed it goes right until the moment that it gets the negative
value, even if i make the negative value positive with abs() that did not solve because
then he tries to to part 170 from 170 or so. So my speed value drops to zero.

This is my code


curVal=abs($kolom.rotation.Z_rotation)
oldVal=at time (currentTime - 1) abs($kolom.rotation.Z_rotation)
speedVal=abs(curVal-oldVal)
-speedVal/100



I have my file here http://www.muhneer.nl/3d/rotation.max

Maybe someone knows something to fix this, or a direction

thanks in advance

PiXeL_MoNKeY
03-14-2006, 07:55 PM
The best way to resolve this would probably be to retrieve the rotations in quaterion instead of euler values. You may try looking at Cunety Ozdas rolling ball maxscript tutorial (http://www.cuneytozdas.com/tutorials/maxscript/).

Hope this helps,
-Eric

CGTalk Moderation
03-14-2006, 07:55 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.