camera rotation using lerp issue
I have code to look between different points and i want a smooth transition so I am trying to use lerp but it still jumps straight to each rotation without any transition. Inside the fps script I have:
on switch view button press{
lookTarget = transform;
lookTarget.LookAt (waypoints [viewWaypoint]);
}
void RotateView()
{
transform.rotation = Quaternion.Lerp(transform.rotation, lookTarget.rotation, Time.deltaTime*10);
}
Any ideas??
Answer by Oribow · Oct 16, 2015 at 08:19 PM
Quaternation.Lerp interpolates between two points, based on the third argument. You must call it every frame untill the transition is finished. Also read the docs: http://docs.unity3d.com/ScriptReference/Quaternion.Lerp.html The third parameter will get clamped to [0, 1], thats the reason why your camera reaches its point instant. Remove the 10 and put the lerp function somewhere in the update methode.
Your answer
Follow this Question
Related Questions
Cardboard camera issues 1 Answer
Object Rotate with Camera 2 Answers
Standard Asset Camera Movement Issue 0 Answers
How to set rotation of GvrMain? 1 Answer