Skip to content

Instantly share code, notes, and snippets.

@ohiofi
Created April 12, 2018 17:10
Show Gist options
  • Save ohiofi/1b8952d88d66e9808da8ab1e236b1d6b to your computer and use it in GitHub Desktop.
Save ohiofi/1b8952d88d66e9808da8ab1e236b1d6b to your computer and use it in GitHub Desktop.
public bool IsWallToLeftOrRight(){
bool wallOnLeft = Physics2D.Raycast (new Vector2 (transform.position.x - width, transform.position.y), -Vector2.right, rayCastLengthCheck);
bool wallOnRight = Physics2D.Raycast (new Vector2 (transform.position.x + width, transform.position.y), Vector2.right, rayCastLengthCheck);
if (wallOnLeft || wallOnRight)
return true;
else
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment