# It's normal this deltaTime inconsistency on iPad?

Hello, i am using a simple script to let my character controller run and jump:

``````public float speed = 12;
public float jumpSpeed = 27;
public float gravity = 100;
private Vector3 moveDirection = Vector3.zero;

void Update() {
if (controller.isGrounded) {
moveDirection = Vector3.right;
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
if (Input.GetButton("Jump")) // on the ipad i jump using the joystick.isFingerDown()
moveDirection.y = jumpSpeed;

}
moveDirection.y -= gravity * Time.deltaTime;
controller.Move(moveDirection * Time.deltaTime);
}
``````

}

Now, when i jump in the editor the max height my character can reach is Y = 3.8.
But when i build my game and play it from my iPad2 i get different values.

On iPad at 30FPS i get Y= 4.2
On Ipad at 60FPS i get Y= 4.0

So, less FPS = More powerful is the jump.

It’s normal that i get these little but problematic differences? How can i get the same values?
I even placed the jumping code after the Y gravity calculation, but the results are still different and not consistent.

Thanks.

Ignore gravity for a second and just look at how you apply upward force. moveDirection.y = jumpSpeed. And then below, that value is multiplied by the current deltaTime since the last frame. So yes, in your case frames per second will always dictate a maximum height because your upward impulse is only applied in a single frame and that frames deltaTime will always be larger the lower the frame rate.

``````example:
30 fps, jumpSpeed = 10: Upward movement = 10 * (1/30fps) =  0.3
60 fps, jumpSpeed = 10: Upward movement = 10 * (1/60fps) = 0.16
120 fps, jumpSpeed = 10: Upward movement = 10 * (1/120fps)= 0.08
``````

There is probably a smarter way to than this but I would suggest sampling your object’s height at the current frame and continue to apply an upward impulse if they haven’t reached a maximum height. Once there, change moveDirection.y to be -gravity;

Try using GetButtonDown instead of GetButton… that’s the only thing I can figure is causing any weirdness. In a low-framerate situation you might be getting multiple jump triggers, which is causing your player to ‘float’ a bit. If you use GetButtonDown you guarantee that only the first hit of “jump” gets triggered, and it should be consistent across multiple framerates.