- Home /
Question by
AngryCSharpNerd · Jun 25, 2013 at 04:31 PM ·
camerarotationquaternionlerpslerp
Transition current camera rotation to 0,0,0
I can't find what I'm supposed to use, or how to use it correctly like Slerp, lerp, all these quaternion stuff and this is what I have so far:
At 0:04 I automatically MoveTowards the center. I want my camera's rotation to transition to an upward position, or basically like making your head look up.
How would you do this? Thanks.
Comment
Best Answer
Wiki
Answer by Oskar Lundqvist · Jun 25, 2013 at 09:22 PM
Try this:
var targetRotation : Vector3;
var progress : float = 0;
var rotateSpeed : float = 1.0;
function Update() {
transform.rotation.eulerAngles = Vector3.Lerp(transform.rotation.eulerAngles, targetRotation, progress);
progress += Time.deltaTime * rotateSpeed;
}
You would have to reset the progress
value when the rotation is finished and so on, but this is a base to work from.
Hope it helps :)