Sleeping Guard Interaction

Simon Leen
3 min readAug 10, 2021

--

Objective: Set up the sleeping guard cutscene trigger.

Following on from the last post, we will now work on the Player getting the Key Card from the sleeping guard.

You will notice the green outline in the above image. This is a cube, sized up to match a trigger area around the guards desk to use for the OnTriggerEnter when the Player gets close. The cube has a Box Collider set to IsTrigger, a Rigidbody with Use Gravity turned off and the MeshRenderer is disable so that it doesn’t appear in the game.

We have a similar issue to the last post. When the cutscene is in effect, there are 2 Players (the playable one and the animated one for the cutscene) and there are 2 guards, only they are placed on top of the same location, making it difficult to notice.

We use the same process as we did in the last post, using an Activation Track for the Player and one for the Sleeping Guard. We set them as active only for the last frame of the cutscene. We then add another Activation Track for the Cutscene but this time being active for all but the last frame. We also update the cutscene to not only having a fade in from black but also a fade out to black as this will help with the transition and swapping of models/game objects.

There are a few ways to move on from here but I decided to use a coroutine triggered when the cutscene is activated, which waits the length of the cutscene then turns off the cutscene. As issue with transitioning from Timeline cutscenes is the camera is taken control of and the last frame is within the cutscene.

To fix this issue we use a camera set in a position to match the sleeping guards desk area, similar to before the cutscene and after the coroutine has finished, set the main cameras position and rotation to this camera.

In the next post, we will start looking at a Game Manager.

--

--

No responses yet