I have a security camera and a collider attached to the detection area. I want the script to detect that the colliding object is a player, and then using a raycast to determine if the player is behind one of the two ledges they can hide behind.
How can I do this? I believe I would have to find the position of the camera and for the origin point, but how can I determine the direction (the camera moves side to side 45 degrees) and length to send the ray?
My script is currently:
class detection_script (MonoBehaviour):
def Start ():
def FixedUpdate ():
def OnTriggerStay(collisionInfo as Collider):
if collisionInfo.collider.tag == "Player":