Game Development Community

Tracking Rotations Higher Than 360

by Daniel Balmert · in Torque Game Builder · 05/21/2010 (12:48 am) · 3 replies

I'm having trouble counting the number of times my little player has done complete flips in the air. Every time he completes a rotation, his rotation zeroes out and it counts back up from 0 degrees. Is there an easy way to track the number of revolutions a sprite has made with script?

For reference, I'm using setAngularVelocity to trigger his spin.

#1
05/21/2010 (1:06 am)
Knowing the angular velocity and knowing the time elapsed, you'd know the number of degrees rotated.

Say:

36 deg/sec over 10 sec means 36*10 = 360 deg = 1 revolution.


#2
05/21/2010 (1:10 am)
Yes, but in my game, you can hold the "flip" button to continue flipping or let go to stop flipping. I can't always guarantee they'll hold it down the exact amount of time needed for a flip.

Is there some way to gather partial segments of time elapsed? Or can I get time elapsed since a button press?

EDIT-

also, certain effects will change your rotation speed in mid jump. Oy.. this is sounding like not a great mechanic to code
#3
05/21/2010 (2:00 am)
take the time the button is held.


if one rotation equals one second and the button is held for 3.8 seconds, then the player has flipped 3.8 times.




::::