- Home /
RigidBody MovePosition code acts differently by framerate
I have a character controller that I update from a singleton manager on the main thread.
The manager passes down the Time.deltaTime
to all the child characters just to make sure they are all attempting to move based on the same time on the frame.
When I build a client, this deltaTime is ~0.0025f
. When in the editor, this value is ~0.015f
If I hold the title bar of the window and drag it, this deltatime is closer to 0.015
and movement looks right. If I don't, the delta time is smaller.
With the deltaTime being ~1/10 of the editor's delta time, my character is moving super slowly as it multiplies speed * deltaTime
for movement.
Has anyone experienced this or know of a good solve?
Answer by KingKRoecks · Jan 18, 2021 at 11:56 PM
FixedUpdate should be used for RigidBody.MovePosition, as its updated at the same rate as the physics rather than independent of the physics update loop.
Your answer
Follow this Question
Related Questions
When I use rigidbody.Moveposition, the object doesn't move accurately. 1 Answer
How to make an object wait until it finishes moving? 0 Answers
Moving an object in Start() vs moving an object in Update() with Time.deltaTime 2 Answers
Rigidbody.MovePosition doesn't move reliably? 1 Answer
Rigidbody.velocity and Time.deltaTime 3 Answers