Ive been making a game with movement like animal crossing, but i don't know how to rotate the player to look at the same position position as the joystick, how could i do this, how could i make it smooth and make the player still look at that direction even when not moving the joystick
Animal Crossing Movement
- Edited
Nexis Make a 2D version first. On each frame, read the joy axes and put them as components into a Vector2
. Normalize this vector and that's your movement direction. Rotate the object by the angle of this vector (returned by Vector2::angle()
) and move it along this vector every frame if either of joy axes is nonzero.
There's more finesse that can be added but those are the basics.
i dont know any of the finesse though
The docs have already most of it, just follow the instructions and use that method @xyz mentioned as data for joystick direction and plug that into the look_at
function.
I still literaly have no idea what im doing