Slowly rotate object towards the North Pole
Im wondering how to slowly rotate my object towards the magnetic North Pole.
Here is how i rotate object, but the rotation is too quick:
function Update () {
transform.rotation = Quaternion.Euler(0, 0, -Input.compass.magneticHeading);
}
Here is what i tried to slow the rotation down, but this is not working.
function Update () {
Quaternion target = Quaternion.Euler(0, 0, -Input.compass.magneticHeading);
transform.rotation = Quaternion.Slerp(transform.rotation, target, Time.deltaTime * 3f);
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612161658im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Rotate object in specific direction 0 Answers
Making 2D Compass From Quaternion 1 Answer
How to make horizontal sliding Compass 1 Answer
2d keep player upright 1 Answer