- Home /
Player movement jittery when hitting walls and using Rigidbody.MovePosition.
I have made a basic character controller to avoid the use of the standard one since it doesn't quite fit my needs. I use MovePosition to move my character but when i push into a wall my character jitters. Shouldn't using MovePosition prevent this? I have a collider on both the wall and player, a rigidbody on both with the wall set to kinematic, and interpolation set to Continuous Dynamic on both. What could be causing this jittering?
Code:
https://pastebin.com/PJjFFxwH
Answer by TreyH · Mar 09, 2018 at 05:50 PM
Jittery motion tends to happen when you're moving physics objects from within Update().
This happens because the engine doesn't stop you from moving something from within Update(), but it calculates collisions during the FixedUpdate() cycle and doesn't allow physics bodies to be within each other.
Try changing Update() to FixedUpdate() to make those movements happen on the physics update cycle. You might need to have your inputs still happen within the normal Update() if those start to seem sluggish.
Your answer
Follow this Question
Related Questions
Jittering effect when moving character and camera 2 Answers
MovePosition not as precise as Translate with Kinematic rigidbodies (example unitypackage included) 1 Answer
Move a rigidbody when Kinematic ?? 3 Answers
Touching compound collider breaks trigger 0 Answers
Rigidbody move position smoothly ? (Point and click with rigidbody) ? 1 Answer