Rotation Question
Hey!
I would like to rotate a Object with rotation a to rotation b. I don't want to set the rotation by setting transform.rotation = ... ; I would like to get a smooth rotation to a certain euler angle. I hope someone can help me.. Thanks
That could help http://answers.unity3d.com/comments/1086975/view.html
Answer by whaleinthesea · Oct 23, 2015 at 08:14 PM
You can make smooth rotations with transform.rotation with a lerp. Apply this script to your object and it should work.
using UnityEngine;
public class SmoothRotate : MonoBehaviour
{
public Quaternion newRotation;
public float duration = 0.01F;
void Update ()
{
transform.rotation = Quaternion.Lerp(transform.rotation, newRotation, duration*Time.deltaTime);
}
}
Your answer
Follow this Question
Related Questions
Why does this quaternion euler not compute? 0 Answers
How to calculate correct angles for PID? 0 Answers
How to add a delay to an object that rotates to face a target ? 1 Answer
Mirror rotation of object along 2 Euler Axis' 0 Answers
How to clamp rotation, following Unity's quaternion rules 1 Answer