摇杆
This commit is contained in:
parent
c9a7061fec
commit
0e36c4c6d3
@ -113,8 +113,7 @@ public class PlayerMovement_Joystick : MonoBehaviour
|
||||
}
|
||||
|
||||
// 应用移动
|
||||
if (moveDirection.magnitude > 0.1f)
|
||||
{
|
||||
|
||||
Vector3 newPosition = rb.position + moveDirection * moveSpeed * Time.fixedDeltaTime;
|
||||
rb.MovePosition(newPosition);
|
||||
MoveState();
|
||||
@ -122,7 +121,7 @@ public class PlayerMovement_Joystick : MonoBehaviour
|
||||
// 使角色面朝移动方向
|
||||
Quaternion toRotation = Quaternion.LookRotation(moveDirection, Vector3.up);
|
||||
transform.rotation = Quaternion.RotateTowards(transform.rotation, toRotation, 720 * Time.deltaTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void HandleViewSwipe(Touch touch)
|
||||
|
Loading…
Reference in New Issue
Block a user