滑动视角test

This commit is contained in:
huyulong 2024-11-19 14:27:13 +08:00
parent dc0b4d5f2d
commit f52e5b1edc

View File

@ -72,7 +72,12 @@ public class PlayerMovement_Jpystick : MonoBehaviour
else if (touch.fingerId == rightFingerId) else if (touch.fingerId == rightFingerId)
{ {
// 右侧触摸:滑动视角 // 右侧触摸:滑动视角
HandleViewSwipe(touch); //HandleViewSwipe(touch);
float horizontalSwipe = touch.deltaPosition.x * 0.1f; // 可调整灵敏度
float verticalSwipe = -touch.deltaPosition.y * 0.1f;
cameraTransform.Rotate(0, horizontalSwipe, 0, Space.World);
cameraTransform.Rotate(verticalSwipe, 0, 0, Space.Self);
} }
} }
else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled) else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled)
@ -141,11 +146,7 @@ public class PlayerMovement_Jpystick : MonoBehaviour
void HandleViewSwipe(Touch touch) void HandleViewSwipe(Touch touch)
{ {
// 滑动视角逻辑 // 滑动视角逻辑
float horizontalSwipe = touch.deltaPosition.x * 0.1f; // 可调整灵敏度
float verticalSwipe = -touch.deltaPosition.y * 0.1f;
cameraTransform.Rotate(0, horizontalSwipe, 0, Space.World);
cameraTransform.Rotate(verticalSwipe, 0, 0, Space.Self);
} }
public void MoveState() public void MoveState()