- Home /
Jump Force (rigid body velocity) is not equal in different mobile phones
I have a simple platformer that allows the player to jump from one platform to another using this code:
JumpForce = GravityForce * JumpHeight;
rigidbody2D.velocity = new Vector2(0, JumpForce);
And a "gravity pull" code that I placed on the update function:
rigidbody2D.velocity = new Vector2(0, rigidbody2D.velocity.y - (GravityForce * GravityForce));
Here are the values of the floats:
Jump Force: 10
Gravity Force: 1.5
Jump Height: 32
This work on the editor flawlessly. However, when I tried it on an android phone, the player jumps too high. The game also lags a bit. I figured out the lag may have caused it. So I tried:
JumpForce = GravityForce * JumpHeight * 35 * Time.deltatime;
rigidbody2D.velocity = new Vector2(0, JumpForce);
It still doesn't work. I think it's probably on the refresh rate or something? I tried disabling Vsync but it only made my game weirder like the player's movement is awkwardly off.
Is there someway I could manage to make the jump force (velocity) universal to all devices, varying from their refresh rates, resolution, etc?
give some explanation about your issue or share your code
Your answer
Follow this Question
Related Questions
Jump Force (rigid body velocity) is not equal in different mobile phones 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Multitouch physics drag with TargetJoint2D 0 Answers
Movement using the Scrollbar 1 Answer