Hi all.
First of all I must tell you that I have fix the fixed timeStep to 0.008 to disable that bouncy effect on collision.
There is my script, the problem is that when I click one time to jump the script run 2 time for 1 click.
With only one click to do a simple jump my player object is jumping 2 time instead of 1.
This code is called in fixed update :
public void Jump(Rigidbody _Rb, float _jumpForce, int _jumpCount)
{
if (_jumpCount > 0)
{
if (Input.GetMouseButtonDown(0) || Input.touchCount > 0)
{
PlayerController.jumpCount --;
_Rb.AddForce(Vector3.up * _jumpForce);
Debug.LogFormat("jump");
}
}
}
↧