Time.deltaTime? No need?

Why don’t we use “Time.deltaTime” when setting a speed? Like this:
moveInput.x * runSpeed * Time.deltaTime

Vector2 playerVelocity = new Vector2(moveInput.x * runSpeed, myRigidbody.velocity.y);

Hi Ruslan,

Welcome to our community! :slight_smile:

In this particular case, we use a Rigidbody2D property. The Rigidbody2D is controlled by the physics engine, which also takes care of the framerate-independency within the physics simulation.

If we override transform.position in Update(), we must multiply by Time.deltaTime to make the movement framerate-independent.

Did this clear it up for you?


See also:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms