Watch Out Those Cameras!- Game Dev Series 72

Objective: create functional security cameras.

Now our Player passed through those guards, we are facing 2 security cameras. However, it seems not working at all. With its cone shape detecting area, it would be easy to make these cameras work again.

In this article, we will bring these cameras come alive.

Detecting area

First we need to figure out where is the detecting area. In Hierarchy, there is a CameraCone under the camera gameobject. Select it and there should have 1 collider in it.

That is what we use to detect the Player. Add a Rigidbody to both of the CameraCone and disable gravity. Then we can create a new script to both CameraCone.

In this script, it will handle the collision with Player and enable the cutscene.

This function is the same as in GuardAI script. Play it and Player should get caught when enter the CameraCone.

Camera animation

Now we should make cameras moving. To move the cameras, we should make a animation to the body of cameras, which is the parent gameobject of CameraCone.

Select one of them, and create a new animation. In the Animation tab, press recording and adjust the rotation on Y-axis.

Them we can adjust the looping of animation. Open Animator tab while Camera_1 is selecting in Hierarchy. The default state of animation should be the one you created. Copy the state and paste one in Animator, and rename it by adding a “reverse” in the end.

Now, let’s set the transition from the origin to reverse. And also create a transition from reverse to origin.

Select the reverse one, in the Inspector, set the speed to -1. This would make the animation plays as backward.

Back to game scene, play the game and now the cameras should move smoothly.

All done! Now we have 2 functional security cameras!

--

--

--

A passionate gamer whose goal is to work in video game development.

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

Recommended from Medium

What is Cloud Visibility? Attain Greater Visibility in the Cloud with CASB Solutions

My Days as A Full Stack Developer working with React and Google Cloud Functions

DevSecOps — SAST integration in AWS DevOps pipeline

In Cloud Formation , now choose to preserve the state!

PHP 8 fresh exciting features — part 2

3 Tips for Product Ownership Success as a Project Manager

Is React Native better than Swift?

Palm Detection and Hand Tracking Model with Python. (Part 1)

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
S.J. Jason Liu

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.

More from Medium

Day 105: Working with Animation Events in Unity

Coroutines in Unity

Building a Custom Cinemachine Virtual Camera Zoom Feature with One Button in Unity

Player Movement in Unity