I’m trying to implement an onscreen joystick to control a 3D avatar’s movement.
- The joystick is from Nipplejs by yoannmoinet
- The perspective camera is fixed in place and continuously lookAt at the moving avatar
- After the character moves a certain distance, the camera will jump to a position behind the character
- I’m using joystick’s radian position for the avatar’s Y rotation
However when I push the joystick 90 degrees, the 3D avatar doesn’t move forward, instead it rotates and moves to the right.
And when the avatar rotates towards a different direction, pushing the joystick 90 degrees results in the avatar again changing to a different direction.
I’ve included a drawing showing the fixed joystick and the above situation.
How can I have the avatar’s direction always match the joystick’s rotation / direction?