Posted March 24, 2026 by Floreos
The major component of what makes up the stealth mechanics is the security camera. I needed it to do three things.
1. Pan from side to side with a light to indicate its field of vision.
2. Detect when the player is within the cone, but not if they're behind a wall or obstacle.
3. Reset the player to a checkpoint when they're spotted.
The first thing I did was set up the model with cone coming out of the front to indicate its line of sight.
I set the cone to overlap all so it could detect the player.
I placed it in my scene and made sure they were all attached to either a pole or a wall so they would not appear to float.
I then set the cone to invisible and put a spotlight that covers the same area so the player could tell the camera's field of view without a large cone in the way.
Then, to make the camera move, I added a timeline that goes back and forth between two values and used it to blend between two rotation values. This creates a convincing camera scanning movement.
I noticed that the default player controller can be detected by overlap but not by line casts so I used that to my advantage. I start with an overlap and check if it's the player in view of the camera. I then trace a line to the player from the camera. If it comes out false, then no obstacles were hit and the player is in sight of the camera.
I created a variable called "Is in View" and set it to true when the player is detected. I then called a custom function to change the color of the camera light to tell the player that they're in the camera view. I then added a delay so the player doesn't get caught instantly when entering the camera's view and then move on to a secondary line of sight check.
This then checks the "is in view" variable and shoots another line cast after the short delay to see if the player stayed in the sight of the camera. If so, I made a "is Spotted" variable which is set to true. The light color is also set to red to tell the player they've been spotted.
Once the player is spotted, I triggered a function that makes a red light flash on the base of the camera and then call another function to set the player back to their last checkpoint. I then reset the "isSpotted" variable so the cameras return to normal.
This function causes the red light on the base of the camera to turn off and on repeatedly until the player is reset back to their checkpoint. This creates the impression of an alarm system.
This function makes the player unable to move once they've been spotted and then sets their position back to the last checkpoint.
This function is called multiple times and simply sets the light color from an array based in an input value. 0 is green. 1 is yellow. 2 is red.
This branch function takes the variable from the camera to stop the player from being able to move when spotted.
Here, the line cast from the camera can be seen, showing the player has been spotted. This is further indicated with the red light.
Here, the green segment of the line cast indicates an obstacle was hit, so the player is not indicated as spotted. The green light supports this.
For the main goal of the game, the player is stealing a vase. Functionally, this vase just acts as a key for the front door of the house, so the player can leave after stealing it, as well as being able to return home after the mission is complete.
Lastly, I set up the dialogue triggers to display the player's thoughts as they progress the level.
But I needed to add optional dialogue for things such as trying to enter the locked front door, so I couldn't have these pieces of dialogue in the same array as the rest.
So, I added a variable to the dialogue trigger's main function to differentiate.
I then created a branch in the dialogue manager to trigger the door dialogue if it's the trigger by the door.
And those are all the major components that made it into my game.
I intended to add more, such as placeable items that block camera view, but I ran out of time for this assignment.