Controlling rotation -- countering rotational velocity

Aug 20, 2009 at 8:58 PM

If I have a body that is rotating with some angular velocity, how do I know how much opposite torque I need to apply to make the object stop rotating?

Aug 20, 2009 at 9:39 PM

Rather than applying torque in the opposite direction, why not try increasing the rotational drag (forgot the term) to a very high value?  It will mean increasing the torque you initially apply to the body, but this should work both to max out the speed of rotation, and to slow down and stop it quickly when you remove the torque. 

I use this for movement and it works very well.  Haven't done it for rotation but I don't see why it shouldn't act the same.

Aug 20, 2009 at 9:59 PM

I did that.  It works pretty well, but I didn't really like the idea of applying HUGE forces on my little object.  Also, rotational drag depends on the rotational speed, so it's not really exact.

Preferably, I'd like to say "when I'm holding down the left or right arrow keys, rotate left or right.  If I'm not holding down either arrow key, don't rotate."

However, it becomes a little more difficult, because if my ship collides with something, I still want it to rotate naturally as a result of the collision.  So I don't think I can have it both ways.  I guess I'll go with the rotational drag.

 

Thanks!

Adman

 

Coordinator
Aug 20, 2009 at 10:42 PM
Edited Aug 20, 2009 at 10:42 PM

Since it is a physics engine you will get a physics reaction out of it. Making a object stop right away will require a huge force if it has a high velocity. One way to stop it right away is to set the velocity to (0,0). However, it will have some unexpected side effects depending on your physics settings - trying it is the only way to know.