Question about gravity and jump velocity

Hello, thanks for the great tutorial. I am really enjoying this tutorial.

I am trying to understand how gravity and jump velocity should translate correctly.

Quick question about the translation from pixel/frame to pixel/second.

Previous target gravity was 1 p/f and jump velocity -22 p/f.

Instead of arbitrary gravity and jump velocity, I think that gravity should be 60 p/s, and jump velocity would be -1320 p/s so that we can multiply time delta to the gravity and jump velocity in order to illustrate similar jump behavior?

I have a bit of a spoiler warning. Unless your game involves scientifically accurate physics simulation, then all games use “arbitrary” values for things like gravity or jump velocity. The actual values that get used are going to be based on how you want your game to feel.

But I think your question is more like “why don’t we just multiply the per-frame values by 60 to convert to per-second values?” The reason is… we don’t need to. All that is important is that you’re aware that the gravity/velocity values are measured in per-second instead of per-frame and need to be adjusted to a value that feels right.

Why I personally feel that multiplier by 60 is a misleading idea is because not all computers use a 60hz (60 fps) monitor, and game’s may not consistently run at 60 frames-per-second either. Though, as a starting point it wouldn’t hurt to do it this way.

I would just use a number that feels right to you and the game you’re wanting to create.

Privacy & Terms