滑动视角test
This commit is contained in:
parent
dc0b4d5f2d
commit
f52e5b1edc
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user