add variables for ZLock ZED and Cam
This commit is contained in:
parent
6e843d76e7
commit
113ea1b349
1 changed files with 16 additions and 10 deletions
|
@ -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;
|
||||||
Vector3 zedDirection = new Vector3(0, 0, 1); //Create Vector towars Z+
|
if (enableZLockZED)
|
||||||
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
|
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)
|
||||||
//same for camera Z rotation compensation
|
camRigDisplayer.transform.localRotation = Quaternion.AngleAxis(zedRigDisplayer.transform.localEulerAngles.z, zedDirection); //rotate only around zedDirection.z with respect to original coordinate system
|
||||||
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)
|
if (enableZLockCam)
|
||||||
camRigDisplayer.transform.rotation *= Quaternion.AngleAxis(-camLeft.transform.localEulerAngles.z, hmdDirection); //compensate only around hmd.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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue