继续修改摇杆
This commit is contained in:
parent
2866ead9c9
commit
c9a7061fec
@ -87,7 +87,7 @@ public class PlayerMovement_Joystick : MonoBehaviour
|
||||
float horizontal = joystick.Horizontal;
|
||||
float vertical = joystick.Vertical;
|
||||
|
||||
// 转换为三维方向向量 (保持在水平面)
|
||||
// 转换为三维方向向量 ( 保持在水平面 )
|
||||
Vector3 inputDirection = new Vector3(horizontal, 0f, vertical);
|
||||
|
||||
// 获取移动方向相对于摄像机的世界方向
|
||||
@ -101,7 +101,7 @@ public class PlayerMovement_Joystick : MonoBehaviour
|
||||
cameraForward.Normalize();
|
||||
cameraRight.Normalize();
|
||||
|
||||
// 计算最终的移动方向 (相对于摄像机的前后左右)
|
||||
// 计算最终的移动方向 ( 相对于摄像机的前后左右 )
|
||||
Vector3 moveDirection = (cameraRight * horizontal + cameraForward * vertical).normalized;
|
||||
|
||||
if (Mathf.Abs(vertical) > 0.01f || Mathf.Abs(horizontal) > 0.01f)
|
||||
|
Loading…
Reference in New Issue
Block a user