In 2d, in degrees, negative degrees possible.
What I want is to rotate the player to face the same direction as the door before opening it, but when I'll do the same again now from the opposite side, the player will face backwards now.
I use Python.
|
|
Look into vectors (an excellent tutorial is provided in the information attached to the vector tag) and interpolation. The following will make sense if you read that linear algebra tutorial: If you have a vector for the door position and the player position, you can calculate the direction you need the player to face in order to have them face the door. You can then simply make the player face this direction. If you also have a unit vector representing the player's direction, you can also interpolate between the player's current direction, and the direction they'll need in order to face the door, in order to create as mooth turn. |
|||
|
|