- Home /
Rigidbody Interpolation doesn't work in my game
Hello everyone,
I am stuck trying to move the character of a third person game. I am using FixedUpdate() to move the player and LateUpdate() to move the camera, but I can not get rid of the "choppy" movement of the player in the scene. The character's rigidbody is not kinematic, and interpolate mode is set to interpolation. (Changing TimeStep from 1/50 to 1/144 almost solves the problem, but it is not a efficient solution.) I am using version 5.6.1f1 and Windows 10.
Can anyone help me? Thank you.
EDIT I though that adding a gif may help you understand my problem. http://i.imgur.com/siNRywX.mp4
I tried almost everything I known, I am currently using these
void FixedUpdate(){
//m_Target.Translate(m_$$anonymous$$ovementDirection * m_$$anonymous$$ovementSpeed * Time.fixedDeltaTime, Space.World);
m_TargetRigidbody.$$anonymous$$ovePosition(m_Target.position + m_$$anonymous$$ovementDirection * m_$$anonymous$$ovementSpeed * Time.fixedDeltaTime);
}
Answer by ryanmillerca · Jun 23, 2017 at 12:39 PM
I can think of two possible causes.
One, you may need to enable interpolation on your rigidbody. Physics engine update defaults to ~50 fps while your game may run faster than that, causing stuttering. Interpolation addresses this. There is a bug with interpolation in Unity 5.6 - so it may not work right if you're on that version.
Two, you may be polling input on FixedUpdate. Best practice is to poll input on Update(), Move Physics objects on FixedUpdate(), and Update your camera on LateUpdate(). Sounds like you're doing 2/3 properly, just check the input.
Good luck!
I am doing everything you wrote before. The problem remains, so I think I'll have to wait for Unity to solve this problem. Thank you very much!
Answer by Squeekpro107 · Jun 18, 2017 at 06:24 AM
Do you have animations running?
Yes I do. I just tried to remove the mesh and the animator from the character (I replaced them with the standard capsule mesh) but I still get the same effect. I am going to edit the question to add a gif.
Your answer
Follow this Question
Related Questions
Collision Detection on Rigidbody with Interpolation and Rigidbody with Extrapolation is different 0 Answers
Kinematic rigidbody with interpolation issue 0 Answers
Interactive cloth interpolation? 0 Answers
Rigidbody 2D with interpolate = cant rotate object 0 Answers
Get Interpolated rigidbody velocity 1 Answer