- Home /
Rotating a Rigidbody with Physics
How can I rotate a Rigidbody to face a target? Note: For networking reasons, I will be using a very low FixedUpdate rate(.1) so I need to use interpolation. Physics is the only option.
I'm not familiar with physics with networking at all so I'm not sure if theres a reason why you couldnt use the Rigidbody AddTorque, is there something preventing this?
http://docs.unity3d.com/ScriptReference/Rigidbody.AddTorque.html
$$anonymous$$y main problem is the low FixedUpdate rate so a lot of the time AddTorque overshoots for me. Is there anything that can shoot straight for the target rotation?
I'm actually not sure at all sorry. any suggestion I give might be a little over-engineered as well but if you are able to get the actual rotation that still needs to be performed in successive FixedUpdate() calls then You might be able to try for an Arrive() like behavior that starts to counteract the current torque as it 'arrives' at the target rotation value but I honestly wouldnt know how to make it exact as you describe. sorry.
Oh, it's okay. I'm going to go close my eyes and think give this a nice long think.
Answer by jpthek9 · Jan 04, 2015 at 05:10 AM
Found the answer... kinda. I'm using a NavMeshAgent to work its magic with acceleration and all that jazz.