diff --git a/Assets/ZED/SDK/Helpers/Scripts/ZEDManager.cs b/Assets/ZED/SDK/Helpers/Scripts/ZEDManager.cs index f92315f..311935b 100644 --- a/Assets/ZED/SDK/Helpers/Scripts/ZEDManager.cs +++ b/Assets/ZED/SDK/Helpers/Scripts/ZEDManager.cs @@ -1940,17 +1940,23 @@ public class ZEDManager : MonoBehaviour //rotationTransformhelper.transform.rotation = zedRigDisplayer.transform.localRotation; //rotationTransformhelper.transform.localEulerAngles = new Vector3(-zedRigDisplayer.transform.eulerAngles.x, -zedRigDisplayer.transform.eulerAngles.y, 0); + bool enableZLockZED = true; + bool enableZLockCam = false; - - Vector3 zedDirection = new Vector3(0, 0, 1); //Create Vector towars Z+ - zedDirection = zedRigDisplayer.transform.rotation * zedDirection; //rotate vector by zedRigRotation (vector should point towards +Z of zedRigDisplayer) - camRigDisplayer.transform.localRotation = Quaternion.AngleAxis(zedRigDisplayer.transform.localEulerAngles.z, zedDirection); //rotate only around zedDirection.z with respect to original coordinate system - - //same for camera Z rotation compensation - Vector3 hmdDirection = new Vector3(0, 0, 1); //Create Vector towars Z+ - hmdDirection = camLeft.transform.rotation * hmdDirection; //rotate vector by cam (HMD) (vector should point towards +Z of HMD) - camRigDisplayer.transform.rotation *= Quaternion.AngleAxis(-camLeft.transform.localEulerAngles.z, hmdDirection); //compensate only around hmd.z with respect to original coordinate system - + camRigDisplayer.transform.localRotation = Quaternion.identity; + if (enableZLockZED) + { + Vector3 zedDirection = new Vector3(0, 0, 1); //Create Vector towars Z+ + zedDirection = zedRigDisplayer.transform.rotation * zedDirection; //rotate vector by zedRigRotation (vector should point towards +Z of zedRigDisplayer) + camRigDisplayer.transform.localRotation = Quaternion.AngleAxis(zedRigDisplayer.transform.localEulerAngles.z, zedDirection); //rotate only around zedDirection.z with respect to original coordinate system + } + if (enableZLockCam) + { + //same for camera Z rotation compensation + Vector3 hmdDirection = new Vector3(0, 0, 1); //Create Vector towars Z+ + hmdDirection = camLeft.transform.rotation * hmdDirection; //rotate vector by cam (HMD) (vector should point towards +Z of HMD) + camRigDisplayer.transform.rotation *= Quaternion.AngleAxis(-camLeft.transform.localEulerAngles.z, hmdDirection); //compensate only around hmd.z with respect to original coordinate system + }