Answer the question
In order to leave comments, you need to log in
How to rotate a character?
There is a character that rotates by a given angle when drawing, we can change this angle, so the character moves along the vector, how to calculate the rotation angle so that the character is always rotated in the direction of the vector?
Answer the question
In order to leave comments, you need to log in
Use atan2 from math.h. And so, school mathematics: the sides of a right-angled triangle are given, it is required to find the angles.
First you need to initialize the coordinate system itself. In this system, you need to get the position of the character itself and the vector of the direction of movement of this character. Then we can already judge how much the direction of the required vector and the vector of the direction of movement coincide.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question