Skip to content

Instantly share code, notes, and snippets.

@MBehtemam
Last active May 29, 2016 09:37
Show Gist options
  • Save MBehtemam/1b1c6aded8651d6dc3b0d7f29d7e92ff to your computer and use it in GitHub Desktop.
Save MBehtemam/1b1c6aded8651d6dc3b0d7f29d7e92ff to your computer and use it in GitHub Desktop.
Is Player Grounded in Unity with CircleCast
public LayerMask layerGround; //Layer mask
private bool IsGrounded()
{
bool isGrounded = false;
if (Physics2D.CircleCast (transform.position, 0.1f, Vector2.down, 0.5f, layerGround)){
isGrounded = true;
}
else{
isGrounded = false;
}
return isGrounded;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment