手动滑动屏幕,旋转模型

费秦迟
2023-12-01
Vector3 previousPosition;
    Vector3 office;


void Update () {
        if (Input.GetMouseButton(0))
        {
            office = Input.mousePosition - previousPosition;
            previousPosition = Input.mousePosition;
            transform.Rotate(Vector3.Cross(office * 0.01f, Vector3.up).normalized, office.magnitude, Space.Self);
        }
}
 类似资料: