The Great Fleece: Security Cameras, Part 1

In this article, I’ll be setting up the movement for the security cameras.

I’ll be using the Animation system to animate the panning movement for the cameras. Since the same animation and controller can be used for both cameras, I will focus on the first camera, then copy everything over.

I make sure the Camera_1 object under SecurityCameras > Camera is selected, then go to Window > Animation > Animation.

Then I’ll make sure Camera_1 is selected and click Create on the Animation window. Then browse into The Great Fleece > Game > Animations, then in the Animations folder, I create a folder named Cameras, then save the anim file to this folder as Security_Camera.

The camera is going to be rotated between 45 degrees and -45 degrees on the Y-axis. So I need to click the record button, set the Y rotation to 45, move the timeline to about 1 second, and set the Y rotation to -45. Then I can stop recording.

Next, I need to go into the Animator for the Camera_1 controller. There I duplicate the Security_Camera animation, naming the copy to Security_Camera_Reverse. Then set a transition between the two animations and set the speed on the copy to -1.

This gives the security camera a nice back and forth movement, although it is moving a bit fast. But I’ll fix that next.

To slow down the speed of the camera movement, we can go into the Animation for Camera_1 and change the sample rate. I am going to change mine to 10. You may need to click the three dots to the left and select Show Sample Rate to get this to show. This is shown below.

This gives a nice slow movement of the security cameras, as shown below.

That completes setting up the animation for the security camera. In the next article, I’ll be setting up the cameras so that they can detect Darren.

I hope you enjoyed this, and until next time I wish you all the best of luck in your coding journey.

--

--

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