- Home /
joystick left right problem unity
I have a joystick working like this using Character Controller script:
if ((moveJoystick.position.y>0))){
controller.Move(transform.forward * moveJoystick.position.y * speed); }
else if ((moveJoystick.position.y<0)){
controller.Move(-transform.forward * moveJoystick.position.y * speed); }
// Move the controller
controller.Move(moveDirection * Time.deltaTime);
angle = Mathf.Atan2(moveJoystick.position.x,moveJoystick.position.y) * Mathf.Rad2Deg;
if (moveJoystick.position.x!=0){
transform.rotation= Quaternion.Euler(new Vector3(0, angle, 0));}
}
The up and down work great but when the joystick is used for side, it does not move much.
Comment
Your answer
Follow this Question
Related Questions
Joystick won't move in Unity 0 Answers
Android joystick & character movement script 0 Answers
3D: how to avoid jerks in a character movement using accelerometer 1 Answer
A node in a childnode? 1 Answer