I must be missing something obvious, but is there a simple way to control the standoff distance to the target when using the “Multipurpose Camera Rig” from the Standard Assets “Camera” Package?
The camera rig and target would seem to track together, given:
// camera position moves towards target position:
transform.position = Vector3.Lerp(transform.position, m_Target.position, deltaTime*m_MoveSpeed);
I have no initial offset between camera and target, but after a few seconds of runtime the camera arrives at an arbitrary (to me) follow distance.
I did note the min. velocity for following the ‘AutoCam.cs’ script, and other requirements of the exposed script variables.
Simple change the z value of the camera in the rig to whatever you want.
So i had the same question and did some digging, eventually i came up with solution in AutoCam.cs add a member variable for distance
[SerializeField] private float m_Distance = 0.0f; // Distance from the target
then at the end add under transform.rotation
transform.rotation = Quaternion.Lerp(transform.rotation, rollRotation, m_TurnSpeed*m_CurrentTurnAmount*deltaTime); transform.position -= transform.rotation * Vector3.forward * m_Distance;
that worked for me
Hi there, it’s actually defined by the pivot:
By adjusting the pivot you can define where the “center” of the focus is going to be, then all the script does is apply the camera the same position as the player