From 113ea1b3490e3540844aa4da3da15e3e5b964ace Mon Sep 17 00:00:00 2001 From: Philipp Kramer Date: Wed, 27 Nov 2019 12:06:25 +0100 Subject: [PATCH] add variables for ZLock ZED and Cam --- Assets/ZED/SDK/Helpers/Scripts/ZEDManager.cs | 26 ++++++++++++-------- 1 file changed, 16 insertions(+), 10 deletions(-) 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 + }