Created
June 24, 2018 21:37
-
-
Save kpavlovsky/835b256b013e9dd0539abd3099fb6dc0 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
bool checkSeesEnemy(){ | |
int layerMask = 1 << 8; | |
RaycastHit hit; | |
if (Physics.Raycast(transform.position, transform.TransformDirection (Vector3.forward), out hit, see_distance, layerMask)) { | |
Debug.DrawRay(transform.position, transform.TransformDirection (Vector3.forward) * hit.distance, Color.yellow); | |
Debug.Log("Did Hit"); | |
return true; | |
} else { | |
Debug.DrawRay(transform.position, transform.TransformDirection (Vector3.forward) *1000, Color.white); | |
Debug.Log("Did not Hit"); | |
return false; | |
} | |
} | |
bool checkObstacleAhead(){ | |
int layerMask = 1 << 9; | |
RaycastHit hit; | |
if (Physics.Raycast(transform.position, transform.TransformDirection (Vector3.forward), out hit, see_distance, layerMask)) { | |
Debug.DrawRay(transform.position, transform.TransformDirection (Vector3.forward) * hit.distance, Color.yellow); | |
Debug.Log("Did Hit"); | |
return true; | |
} else { | |
Debug.DrawRay(transform.position, transform.TransformDirection (Vector3.forward) *1000, Color.white); | |
Debug.Log("Did not Hit"); | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment