- Home /
Rigbody.velocity stopped working and only displays 0 out of nowhere
I use rigidbody.MovePosition and for a few weeks my program has been working splendid. Yesturday I imported TextMeshPro, Universal Render Pipeline and Unity's Particle System Prefab package. After this the project still worked fine. I booted up unity today and no matter what I do rb.velocity is 0. Once in a blue moon it will display a very large value (60 unity/s+) for just a moment. I have no idea what could have happened. Anyone have any ideas?
unless you post some more details like how your object is set up probably noone will be able to help you.
Answer by Edy · Feb 16 at 05:13 PM
Ensure to call Rigidbody.MovePosition exactly once per physics frame (FixedUpdate). If MovePosition is called twice or more times with the same value, then Rigidbody.velocity will be zero. This may happen if you're calling MovePosition from Update or from some other event unrelated to physics.
If you're explicitly calling Physics.Simulate(), then ensure that:
1) Call MovePosition exactly once before calling Physics.Simulate().
2) Physics.autoSimulation is not being set back to true somewhere else.
Your answer
Follow this Question
Related Questions
Moving rigidbody (Player) with addForce or Velocity ? 1 Answer
VR Sword Physics, how to add force or velocity to the sword for impact when it hits an object 1 Answer
Rigidbody physics - equalizing force 1 Answer
Rigidbody.velocity seems to be breaking jumping physics 0 Answers
rigidbody movePosition behaves very differently from 2017.1.0f3 to 2017.3.0f3 0 Answers