I want to make a swipe wherever you go, there and the camera. When I swipe, the camera is only half true. It rotates absolutely on all axes (it is overwhelmed). Can someone help?
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; public class Swipe : MonoBehaviour, IDragHandler { Vector2 delta; Quaternion rotationX; Quaternion rotationY; Quaternion originRotation; public GameObject Camera; public void OnDrag(PointerEventData eventData) { delta = eventData.delta; rotationX = Quaternion.AngleAxis(delta.x, Vector3.up); rotationY = Quaternion.AngleAxis(-delta.y, Vector3.right); originRotation = Camera.transform.rotation; } private void FixedUpdate() { Camera.transform.rotation = originRotation * rotationY * rotationX ; } }