N
N
Nike232021-06-30 22:16:54
C++ / C#
Nike23, 2021-06-30 22:16:54

How to rotate an object through a script more than 180, -180 degrees?

I want the player to be able to rotate the cube in any direction an unlimited number of times. Up to 90 180 everything rotates fine, but if I want to rotate the cube again, it will be -180 -189 -188 .... , although it should be 180 181 182 ...
I've been puzzling over this for several days and I can't understand how to rotate the cube through a script by more than 180, 360 and so on ad infinitum.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
Xoggas, 2021-07-01
@Xoggas

Unity uses a quaternion system, so 180 ordinary degrees is 180 degrees in quaternions, and 360 is -180 degrees in quaternions, in theory everything is correct. If anything, use Quaternion.Euler(x, y, z) as input, it takes our "human" degrees

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question