通过触摸旋转屏幕停止运动

时间:2020-04-23 09:16:37

标签: android unity3d touch joystick

我正在开发移动设备,通常使用操纵杆移动角色,但是自从添加脚本以通过触摸输入旋转屏幕以来,操纵杆现在不会移动角色,而只是旋转角色。是否可以解决此问题,可能是设置优先级还是将其设置为必须在特定区域内触摸?

这是旋转脚本:`使用UnityEngine;

公共类SwipeRotate:MonoBehaviour {

private Touch touch;
private Quaternion rotationY;
private float rotationSpeedModifier = 0.2f;
void Update() {

    if (Input.touchCount > 0) {

        touch = Input.GetTouch(0);

        if (touch.phase == TouchPhase.Moved) {

            rotationY = Quaternion.Euler(0f, - touch.deltaPosition.x * rotationSpeedModifier, 0f);

            transform.rotation = rotationY * transform.rotation;

       }

    }

}

} ` 这是动作脚本:https://pastebin.com/L2GvMNVs

0 个答案:

没有答案