- Home /
How to set the follow distance to a target object when using the “Multipurpose Camera Rig”?
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.
Answer by RavenOfCode · Jan 01, 2017 at 04:39 PM
Simple change the z value of the camera in the rig to whatever you want.
Answer by tkhris2 · Apr 19, 2017 at 10:17 AM
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
Actually, this worked for me, this helped me manually set the distance from the target and saved a lot of research time and brain stor$$anonymous$$g. Thank you so much!
Answer by rgudino · Dec 03, 2018 at 01:28 AM
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
Your answer
Follow this Question
Related Questions
2D camera follow horizantal only? 1 Answer
Help make camera zoom smoother 3 Answers
Switching camera between characters 0 Answers