You don't want to set the position or screw with the velocity I don't think. I would use forces.
A good start would be calculating the difference in orientation. (I'm on lunch break, so this is just off the top of my head)
Code: Select all
delta_angle = asin(cpvcross(body->rot, desired_rotation_vector))
From that you can apply a damped torque, maybe something like:
Code: Select all
torque = -delta_angle*torque_multiplier - body->w*damping_multiplier
Adjust the multipliers until it feels right. Also, it might be more physically correct to square body->w, I'd have to look it up though. You want to add a check that you aren't reversing the direction of the rotation as well. Clamp the force at (+ or -) body->w*body->i_inv/dt. Depending on your situation, the oscillation might be small enough that you won't need it though.
Makes me think though. Angular springs would be pretty easy to implement like the damped springs I already have. I'll add it to the list.
edit: Forget what I said about the torque earlier if you saw it. It was quite wrong. (In my defense, I typed that while hungry

) It should be better now
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/