Rotate object in specific direction
I have gameobject that rotates (only by y axis) with compass from Input.compass.trueHeading
. For smoothing my rotation I use Mathf.SmoothDamp()
and it works perfect, but only when I'm rotating in clockwise direction. If I rotate my phone in counterclockwise direction and passing 0° (eg. from 12° to 350° in counterclockwise direction) my gameobject start to rotate in clockwise direction until it reach desired degree.
Before that I used Mathf.SmoothDampAngle()
for calculating my rotation, but than I had problem with short-way rotation (when I want to rotate my object from 12° to 350° in clockwise direction it starts to rotate in short-way direction, which is 22° by counterclockwise
So the question is: how I can improve my rotation and rotate my gameobject in specific direction by Imput.compass.trueHeading
?
Your answer
Follow this Question
Related Questions
Making 2D Compass From Quaternion 1 Answer
Problem with Quaternion and Euler Angles 0 Answers
How to convert Quaternions to Euler angles with different order? 0 Answers
Instantiate object in orientation of previously instantiated object 1 Answer
If rotation was over 20° smoothly rotate towards the next 90° 2 Answers