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.