add variables for ZLock ZED and Cam

This commit is contained in:
Philipp Kramer 2019-11-27 12:06:25 +01:00
parent 6e843d76e7
commit 113ea1b349

View file

@ -1940,17 +1940,23 @@ public class ZEDManager : MonoBehaviour
//rotationTransformhelper.transform.rotation = zedRigDisplayer.transform.localRotation; //rotationTransformhelper.transform.rotation = zedRigDisplayer.transform.localRotation;
//rotationTransformhelper.transform.localEulerAngles = new Vector3(-zedRigDisplayer.transform.eulerAngles.x, -zedRigDisplayer.transform.eulerAngles.y, 0); //rotationTransformhelper.transform.localEulerAngles = new Vector3(-zedRigDisplayer.transform.eulerAngles.x, -zedRigDisplayer.transform.eulerAngles.y, 0);
bool enableZLockZED = true;
bool enableZLockCam = false;
camRigDisplayer.transform.localRotation = Quaternion.identity;
if (enableZLockZED)
{
Vector3 zedDirection = new Vector3(0, 0, 1); //Create Vector towars Z+ 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) 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 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 //same for camera Z rotation compensation
Vector3 hmdDirection = new Vector3(0, 0, 1); //Create Vector towars Z+ 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) 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.rotation *= Quaternion.AngleAxis(-camLeft.transform.localEulerAngles.z, hmdDirection); //compensate only around hmd.z with respect to original coordinate system
}