Quantcast
Channel: Questions in topic: "independent"
Viewing all articles
Browse latest Browse all 102

Jump not framerate independent

$
0
0
Hey, I'm using a custom 2D controller, it has a Move() method that uses transform.Translate(velocity) to move the character. In my player controller script I apply gravity by doing this every frame right before I call Move() : velocity.y += gravity * Time.deltaTime; My Jump() method is called before the gravity, and sets the velocity.y to the jumpForce **once**. At 60+ fps i'm able to jump over a specific amount of tiles, at 30 fps I miss the last tile by a small amount of height, the weird thing is that if I slow down the game with time scale, I reach the same height. What is going on? **EDIT:** Bunny83's solution worked perfectly, I'm going to keep Eno-Khaon's answer because it clearly explains the issue, thanks guys much appreciated

Viewing all articles
Browse latest Browse all 102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>