void Update() { transform.position = new Vector3(_currPos.x, _currPos.y, 0); if (_isTouch && Vector2.Distance(_orgPos, _currPos) > maxDis / 8.0f) { //float r = Mathf.Atan2(_currPos.y-_orgPos.y, _currPos.x-_orgPos.x); //float joystickPolar = (-(r*180.0f/Mathf.PI))+90.0f; //Debug.Log (joystickPolar); player.Move(new Vector3(_currPos.x - _orgPos.x, 0, _currPos.y - _orgPos.y).normalized); /*if(joystickPolar>=-45.0f && joystickPolar < 45.0f){ //front * player.MoveForwardWithRotation(Quaternion.Euler(0, 0f, 0)); * } * else if(joystickPolar>=45.0f && joystickPolar < 135.0f){ //right * player.MoveForwardWithRotation(Quaternion.Euler(0, 90.0f, 0)); * } * else if(joystickPolar>=135.0f && joystickPolar <225.0f){ //back * player.MoveForwardWithRotation(Quaternion.Euler(0, 180.0f, 0)); * } * else{ //left * player.MoveForwardWithRotation(Quaternion.Euler(0, -90.0f, 0)); * }*/ } }