Hi, I have started writing my first java project a few days ago.
It is a small game where I am using an onscreen joystick to turn the player.
I already have the joystick and the player but I cant find out how to turn the player by the angle of the joystick.
Code:
//get the angle
//initx,inity is the start point of the joystick
//touchingPoint is the point where the finger is touching the screen.
angle = Math.atan2(touchingPoint.y - inity,touchingPoint.x - initx);
//rotate the player
player_mesh.rotateY((float) (jpctaetest.controls.getAngle()/10)* ft);
I think it am using the wrong way for the angle because my player mesh is rotating slow when the joystick is on the right side and very fast when it is on the left
please help