The Great Fleece: Eyesight for the Guards

As you could tell by the title, I’m going to demonstrate a simple way to give the security guards eyesight in the game. Once they see Darren the game over cutscene will play.

The method here is to create a collider and size it appropriately for the line of sight. Heres what mine looks like:

All I’ve done here is created a box collider and positioned it in front of our guard and made this game object a child of the security guard game object. That way, when the guard moves, the collider moves as well.

I created a super easy script to handle the functionality of getting the eyes to trigger the game over cutscene when they collide with Darren and added it to the collider.

Easy right? We simply use SetActive() to enable the game over cutscene. This isn’t going to be totally sufficient though. Later on when we get caught by the cameras in the long hall way you’ll be able to see 2 versions of Darren. I’ll dig into that in a later article.

DONT FORGET YOUR RIGIDBODY COMPONENT!!! I forgot to add it when I was setting this up and got pretty frustrated lol Anytime you are dealing with collisions always have a rigidbody on at least one of the colliders.

Repeat the process for all the guards and viola!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store