I’m having issue that jump height is different due to frame rate, i looked some old post but I’m not sure where to start. Can someone look into my script and tell me what to do?
I’m using playerstatemachine to control the player movement.
void StateEnterJump()
{
actions.Jump();
GetComponent<Rigidbody> ().velocity = new Vector3 (GetComponent<Rigidbody> ().velocity.x, thePlayer.InitJumpSpeed ());
SetState(PlayerStates.IN_AIR);
}
void StateInAir()
{
HandleHorizontalInput();
DirectionCheck();
CheckCanClimb ();
if (Input.GetKeyDown("f") && fireTimer > fireRate)
{
fireTimer = 0.0f;
SetState(PlayerStates.ATTACK);
}
// if (Input.GetKeyDown(KeyCode.Space) && canDoubleJump == true)
// {
// SetState(PlayerStates.ENTER_JUMP);
// canDoubleJump = false;
// }
else
{
CheckForGround();
CheckForMud();
if (onMud)
{
SetState(PlayerStates.MUD);
}
if (onGround)
{
HandleLandOnGround();
Debug.Log("handled");
}
}
}