2DPlatformer-Tutorial
2DPlatformer-Tutorial copied to clipboard
Player jump height changes based on frame rate
The player jumps much lower when the frame rate is limited compared to when it's unlimited.
How can I ensure the jump height does not change based on the frame rate?
You have to calculate vertical movement twice, before and after Move().
Something like this:
velocity.y += gravity * Time.deltaTime / 2.0f; controller.Move(velocity * Time.deltaTime); velocity.y += gravity * Time.deltaTime / 2.0f;
I recommend to use this method every time you have to calculate acceleration/deceleration.
Cheers!