- Home /
Problem is not reproducible or outdated
stuttering physics
When I try to move my character-object (car on road) by physics (rigidbody.velocity) it vibrates a little when mooving! And because my camera is following this object, it is vibrating too and everything became stuttering on screen! Where is my problem? I try everything to fix it!
It's hard to know precisely where your problem is when you don't post any code, but often, physics stuttering has to do with incorrect usage of time dependent physics, eg. using physics in Update where it should be FixedUpdate, or using it in FixedUpdate but still multiplying by Time.deltaTime, and so on.
Anyway, post some code, then I'm sure someone will have a look at it.
Try setting Rigidbody->Interpolate to Interpolate
http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody-interpolation.html
It became worse! Object begun to slowing down and stuck every second!
Didn't try to set the velocity directly before but the docs says this can result in unrealistic behaviour: http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody-velocity.html Not sure if using AddForce() will solve the issue.
Answer by DevMac1 · Aug 05, 2013 at 02:57 PM
Thank you, I found, that my variable CurrentSpeed (from code below) was changing in Update() too, so, moving it to FixedUpdate() solve the problem! Thx!