Delta Time and Target FPS

I figured that the way we implemented delta time should make it frame rate independent. But when I comment out “SetTargetFPS(60);” the gravitation buggs out.

I really can’t understand why.

Do we have to set a target FPS anyway?

Hi there! Can you describe how gravity is bugging out for you?

I can jump just half a character (roughly) into the air and it takes about 5 seconds to get back to the ground again.
dapper_dasher

And the only thing I’ve done is comment out the SetTargetFPS(60). If I change it to another value it works (although can get glitchy at low FPS but that is to be expected)

And here is my git for the project https://github.com/Naelsh/GD_DapperDasher

Try changing velocity and gravity to float instead of int.

As frame rates get higher, deltatime gets closer to 0, so multiplying an int by a value close to 0 is likely to result in 0

3 Likes

thank you! that did wonders

Glad I could help :slight_smile:

1 Like

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

Privacy & Terms