D
D
destrix2020-09-21 22:24:50
C++ / C#
destrix, 2020-09-21 22:24:50

Rotating an object in Unity?

There is an object on the stage. When I reach the trigger, I unfold it through That is, the object must go in a square (rectangle). Initially, it has ratation = 0, 90, 0. That is, with each such rotation, there should be y > 180 > 270 > 360. But there are times when the object does not rotate by as much as 90 degrees, or maybe by + - 0.1-0.9. That is, it happens like this: 90 > 180> 269.89>... I don’t understand why this is because there is only one turn in the code and only EXACTLY 90. transform.Rotate (0f,90f,0f);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2020-09-21
@GavriKos

EXACTLY 90

and it's not even. 90f - float - cannot be "exactly" in any way.
Write your own rotation function. And even better - make a movement to a point along the vertices of the square, and not turns.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question