Sleeping Guard Interaction

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.





Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Data Quality and Testing Frameworks

Python Lists in under 10 minutes

People over process - Agile Australia 2018

AWS DMS and Change Data capture

The Most Underrated Kotlin Function

An Introduction to Flutter: A Beginner’s Guide


Introduction to Fluture — A Functional Alternative to Promises

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
Simon Leen

Simon Leen


More from Medium

Quick tip — Enabling post-processing in Unity Universal Render Pipeline

What are Unity Skyboxes?

Adding a collectible ammo charge powerup

Making A 2D Shooter — More Power