|
How can I make an if statement that runs if there is a line of sight between two objects? For example checking if a enemy can see the player in a maze like map?
(comments are locked)
|
|
You can use Raycasting to do this. Cast a ray from the enemy object to the player object, and check the hit results. If the first hit result is the player, then the enemy can see the player. For example, in your Enemy script (make sure the "player" variable has a reference to the player in it): var player : Transform;
(comments are locked)
|
