public override void OnSetRotation(CameraController.SetRotationPayload payload)
        {
            var eulerDir = Vector3.zero;

            if (payload.cameraTarget.HasValue)
            {
                var newPos       = new Vector3(payload.x, payload.y, payload.z);
                var cameraTarget = payload.cameraTarget.GetValueOrDefault();
                var dirToLook    = (cameraTarget - newPos);
                eulerDir = Quaternion.LookRotation(dirToLook).eulerAngles;
            }

            defaultVirtualCameraAsFreeLook.m_XAxis.Value = eulerDir.y;
            defaultVirtualCameraAsFreeLook.m_YAxis.Value = eulerDir.x;
        }
示例#2
0
        public override void OnSetRotation(CameraController.SetRotationPayload payload)
        {
            var eulerDir = Vector3.zero;

            if (payload.cameraTarget.HasValue)
            {
                var newPos       = new Vector3(payload.x, payload.y, payload.z);
                var cameraTarget = payload.cameraTarget.GetValueOrDefault();
                var dirToLook    = (cameraTarget - newPos);
                eulerDir = Quaternion.LookRotation(dirToLook).eulerAngles;
            }

            if (pov != null)
            {
                pov.m_HorizontalAxis.Value = eulerDir.y;
                pov.m_VerticalAxis.Value   = eulerDir.x;
            }
        }
示例#3
0
        public override void OnSetRotation(CameraController.SetRotationPayload payload)
        {
            var eulerDir = Vector3.zero;

            if (payload.cameraTarget.HasValue)
            {
                var newPos       = new Vector3(payload.x, payload.y, payload.z);
                var cameraTarget = payload.cameraTarget.GetValueOrDefault();
                var dirToLook    = (cameraTarget - newPos);
                eulerDir = Quaternion.LookRotation(dirToLook).eulerAngles;
            }

            if (defaultVirtualCamera is CinemachineVirtualCamera vcamera)
            {
                var pov = vcamera.GetCinemachineComponent <CinemachinePOV>();
                pov.m_HorizontalAxis.Value = eulerDir.y;
                pov.m_VerticalAxis.Value   = eulerDir.x;
            }
        }
 public virtual void OnSetRotation(CameraController.SetRotationPayload payload)
 {
 }