Working with Cinemachine
Learning how to use the Look At and Aim
One of the unique features with working with Cinemachine is that it provides you with several useful features, and one of them is called “Aim and Look At”. With “Look At” it basically sets any game object as a target so whenever that game object moves the camera will follow suit. The Aim function dives deeper into the “Look At” function with additional settings and adjustments.
To understand better how these functions work together, we are going to set up a scene with a plane and any 3D object.
We are then going to create an animation of the cube where the cube is going to move around the plane.
With the Cinemachine installed and imported to the scene, we are going to setup the Virtual Camera to follow the cube movement. First we are going to drag the cube game object into the “Look At” slot.
We immediately noticed that the Virtual camera quickly snaps into focus in the direction of the cube.
And when the cube is now in motion, the camera will try and stay on target following the cube.
You will also noticed that during the game play, the cross hair for the camera aim is lagging behind the cube just by a tad bit. This is because the “Aim” feature is setup to track the cube a bit slower.
To adjust this, we need to go into the “Aim” settings and under the Lookahead Time slider. The higher the the value the higher the offset.
Just remember that the “Look At” function and the “Aim” function are tied together, and the “Follow” function “Body” function.