Last active
April 9, 2018 18:01
-
-
Save ohiofi/5c0fdd3a70f6ed7e956a8d5e996fca59 to your computer and use it in GitHub Desktop.
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 bool PlayerIsOnGround(){ | |
bool groundCheck1 = Physics2D.Raycast (new Vector2 (transform.position.x, transform.position.y - height), -Vector2.up, rayCastLengthCheck); | |
bool groundCheck2 = Physics2D.Raycast (new Vector2 (transform.position.x + (width - 0.2f), transform.position.y - height), -Vector2.up, rayCastLengthCheck); | |
bool groundCheck3 = Physics2D.Raycast (new Vector2 (transform.position.x - (width - 0.2f), transform.position.y - height), -Vector2.up, rayCastLengthCheck); | |
if (groundCheck1 || groundCheck2 || groundCheck3) | |
return true; | |
else | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment