Rigidbody.MovePosition()

Please have a look at the example on this page:

My understanding of Time.deltaTime is that the way it is used here, it creates code that isn’t framerate independant (calling something on a fixed intervall and using the deltaTime of a variable intervall).
I’ve never used this subforum, was I correct to report this here?

The example is correct.

While in FixedUpdate, Time.deltaTime actually returns Time.fixedDeltaTime.

Let’s say that your physics timestep is 1 tick/second, and your speed is 1 unit/tick.

Under that scenario, every second you would move 1 unit. Now let’s say you have some physics issues and want to call FixedUpdate more often, so you change your physics timestep from 1 tick/second to 2 ticks/second.

Without using Time.deltaTime, you would now be moving 2 units/second (the function is being called 2x as much!). With Time.deltaTime you would still be moving 1 unit/second (as expected).

1 Like

Oh, my bad! I didn’t know that, thanks for explaining! It’s a bit confusing for me that there are these two destinct functions that do different things in different context. I didn’t even know it was possible for deltaTime to know from where it’s called. Learned something new today, thanks.