Objective: Place security cameras in your game and give them basic swivel animation.
If you are making a stealth game a common enemy to sneak passed would be cameras. In this tutorial we are going to implement camera assets and give them a simple panning animation.
To begin, drag your camera assets from your project view into the scene view and place them where you want your cameras to be in the world.
In this tutorial I’m going to focus on one camera at a time. Select the camera you want to animate and open the animation window.
Create an animation clip.
Also create a folder to house your camera animations
Reselect the object you are animating and press the record button.
While recording you are going to set the rotation Y axis to the angle you want, for me that value is 45.
Navigate to your animation folder > Camera folder > select the security cam and turn the loop time off.
Open the animation controller copy and paste the security cam and rename it reverse and set the speed to -1.
Make a transition to and from the two animations
Set the sample rate to 10 to slow down the animation.
To animate another camera with the same panning animation you can reuse the animation clip and controller for a speedy set up.
Now your game has camera’s placed in the world and they are animated to scan the area. In the next tutorial we will add function to the camera to detect the player. I’ll see you in the next tutorial.