-
-
Save MBehtemam/1b1c6aded8651d6dc3b0d7f29d7e92ff to your computer and use it in GitHub Desktop.
Is Player Grounded in Unity with CircleCast
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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