//======================================================================
void Update ()
{
if (Input.GetMouseButtonDown (0))
{
Jump ();
}
}
void Jump()
{
if (IsGrounded())
{
rigidBody.AddForce (Vector2.up * jumpforce, ForceMode2D.Impulse);
}
}
public LayerMask groundLayer;
bool IsGrounded()
{
if(Physics2D.Raycast(this.transform.position, Vector2.down, 0.2f, groundLayer.value))
{
return true;
}
else
{
return false;
}
}
//======================================================================
I want to know why the character jump continuously in the air.
I attached the file, please.(unity 5.6. beta 9)
Thank you.
4546168–421855–Leni’s Games.zip (1020 KB)