Security Camera, Alarm, and Door

SecurityCameraAndDoorHeader.png

The security camera Blueprints seen throughout the level are designed to interact with the player when in Play mode. During play, they will pan back and forth in a search pattern. When the green search cone overlaps a pawn, the light turns red and the camera begins to track player movement. It continues to track the player until the player moves out of range. Then, after a few seconds, it returns to searching.

This Blueprint is also responsible for handling a scene capture, which is used later in the security screen Blueprint.

Of particular importance in this Blueprint is the use of a Blueprint Interface . A Blueprint Interface works like a conduit, allowing functionality to be shared across multiple other Blueprints. Any Blueprint that implements a given Interface automatically inherits all of the functionality that is a part of that Interface. In this way, you can create sophisticated networks of Blueprints that can all work together toward a given goal.

In this example, the Security Alarm Interface acts as a data conduit, allowing us to share functionality with both the Alarm Beacon and the Door Blueprints, specifically, whether the alarm is on or off.

InterfaceConceptDiagramNew.jpg

Camera Blueprint

The Camera Blueprint serves as the heart of the alarm system, for it is this Blueprint that interacts with the player and causes the alarm to sound. Along with implementing an Interface for Blueprint communication, the Camera also makes use of a Timeline node. This is a special node built to handle animation.

Timeline_Camera.png

A Timeline can contain any number of animated tracks, whose data can then be sent out as an output, used to drive any number of effects. In this case, the Timeline is used to drive the scanning rotation of the camera as it pans back and forth.

Blueprint Setup

The Components List, Construction Script, and Event Graph for this Blueprint perform the following tasks:

Blueprint Aspect Purpose
Components List

The Components List for the camera contains the following components:

CameraCS.png

Most of the elements are self-explanatory. The SceneCapture Component works just like a camera, except that instead of outputting what it sees to the screen, it instead populates a texture, which can then be used in a Material.

Construction Script

The Construction Script performs the following tasks:

  • Set up the Scene Capture to record to a Render Target Texture.

  • Use incoming values from Editable variables to set up the Spot Light for the camera.

  • Set the camera's default rotation angle.

  • Set up a Material Instance Dynamic (MID) for the camera's view cone.

Event Graph

The Event Graph performs the following tasks when a Pawn enters the view cone:

  • Engage the alarm.

  • Change the color of the view cone and the light.

  • Begin tracking the player's movement.

When the Pawn exits the view cone:

  • After a delay, disengage the alarm.

  • Return to standard back-and-forth scanning.

  • Every frame (tick), update the rotation of the camera.

  • Transmit via Interface the current state of the alarm.

Editable Variables

The camera has the following exposed properties:

CameraProperties.png

Property Purpose

Scanning

Camera Max Yaw The maximum angle of side-to-side scanning.
Camera Pitch Sets the pitch angle for the camera. This variable has a 3D widget activated and can be manipulated in the viewport.

Spot Light

Light Attenuation Sets the attenuation radius for the Spot Light Component.
Spotlight Brightness Sets the brightness value for the Spot Light Component.
Light Color Alarm On The color of the Spot Light when the alarm is active.
Light Color Alarm Off The color of the Spot Light when the alarm deactivated.

Targeting

Test Material Alarm Settings Toggles the alarm state for testing and adjustment of the alarm colors.

Blueprint Interface

Blueprint To Trigger Alarm Array This array contains a list of all objects that need to receive updates about whether the alarm is on or off.

Render Target

Scene Capture Texture This holds the Render Target texture that will be used for the security camera monitors.
Scene Capture View Distance Sets the max view distance for the Scene Capture Component. Lower this to improve performance.

Alarm Blueprint

AlarmImage.png

The Alarm Blueprint serves as a visual cue that the player has tripped the alarm by stepping in front of the security camera. When activated, it seems to change from green to red, and a beacon light begins spinning. It continues to do this until the alarm deactivates.

The alarm is turned on and off by receiving messages from the Security Alarm Blueprint Interface , which is implemented by the camera, the door, and the alarm.

Blueprint Setup

The Components List, Construction Script, and Event Graph for this Blueprint perform the following tasks:

Blueprint Aspect Purpose
Components List

The Components List for the camera contains the following components:

AlarmCS.png

The Component List for the alarm is basically a base mesh and 2 lights: one light for the alarm (Spot Light) and another for the neutral state (OffLight).

Construction Script

The Construction Script performs the following tasks:

  • Sets the light colors from the exposed user inputs.

  • Creates and applies a Material Instance Dynamic (MID) for the alarm mesh.

  • If the user is testing the alarm, it swaps out the lights and material settings to show what the alarm looks like when it is on.

Event Graph

The Event Graph performs the following tasks: When we receive a signal from the alarm Interface:

  • Parse whether the signal was to turn the alarm on or off.

  • If turning the alarm on, turn on the Spot Light, turn off the Off Light, and change material colors. Then open a Gate to start spinning the Spot Light.

  • If turning the alarm off, turn off the Spot Light, turn on the Off Light, and change material colors back to original state. Close the Gate that spins the Spot Light.

Editable Variables

The alarm has the following exposed properties:

AlarmProperties.png

Property Purpose
Light Rotation Speed The speed at which the alarm beacon spins.
Test Alarm Material Settings This Boolean forces the alarm to be on for testing purposes. Note that the beacon will not spin if not in Play mode.

Door Blueprint

Door.png

The Door is set up such that it remains open so long as the alarm is not engaged. The moment the alarm is triggered, however, the doors are animated such that they slam shut and will not reopen until the alarm ends. It is important to note that Timelines are used to animate the doors. In fact, there are 2 separate Timelines - one to open the doors and another to close them. This allows the doors to open at one speed and close at another.

The door motion is actually triggered by receiving a signal from the Security Alarm Blueprint Interface , which is implemented by the camera, the door, and the alarm.

Also interesting about the door setup is that the door Timelines do not animate the doors directly. Instead, the Timelines each output a single float value, which is then used to interpolate between two vector locations - an "open" location and a "closed" location.

Blueprint Setup

The Components List, Construction Script, and Event Graph for this Blueprint perform the following tasks:

Blueprint Aspect Purpose
Components List

The Components List for the Camera contains the following components:

DoorCL.png

The Component list for the door essentially contains a trigger volume and 2 door panels.

Construction Script

The Construction Script performs the following tasks:

  • Sets up the position and size for the trigger box volume.

  • Sets the location and scale for each door.

Event Graph

The Event Graph performs the following tasks when we receive a signal from the alarm Interface:

  • Check to see if the signal is turning the alarm on or off.

  • If the alarm is switching on, we check the current state of the doors and then, if they are not open already, we open them.

  • If the alarm is switching off, we check the current state of the doors and then, if they are not already closed, we close them.

Editable Variables

The door has the following exposed properties:

DoorProperties.png

Property Purpose
Door Open Width Sets the end location for the doors as they open. This gets mirrored to the opposite door.
Door Left Size Sets the scale for the left door.
Door Right Size Sets the scale for the right door.