Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player jump height changes based on frame rate #19

Open
tqwewe opened this issue Feb 19, 2022 · 1 comment
Open

Player jump height changes based on frame rate #19

tqwewe opened this issue Feb 19, 2022 · 1 comment

Comments

@tqwewe
Copy link

tqwewe commented Feb 19, 2022

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?

@nandovilla
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants