add fixed (simple videogoggle) mode

This commit is contained in:
Philipp Kramer 2020-01-24 10:43:12 +01:00
parent 48406bb9dd
commit b40f00bcf8

View file

@ -225,9 +225,8 @@ public class ZEDManager : MonoBehaviour
[HideInInspector] [HideInInspector]
public bool estimateInitialPosition = true; public bool estimateInitialPosition = true;
//public bool headfree = false;
public bool zLockZED = false;
public bool ZLockCam = true;
@ -1850,6 +1849,16 @@ public class ZEDManager : MonoBehaviour
/// </summary> /// </summary>
private void UpdateTracking() private void UpdateTracking()
{ {
bool enableFixed = false; //simple video goggle mode
bool zLockZED = true; // rotation of zed camera does not rotate image plane in hmd
bool ZLockCam = false; // do not rotate image plane if hmd rotates
if (enableFixed)
{
zLockZED = false;
ZLockCam = false;
}
if (!zedReady) if (!zedReady)
return; return;
@ -1884,9 +1893,17 @@ public class ZEDManager : MonoBehaviour
//Rotate Image plane with zed rotation //Rotate Image plane with zed rotation
r = zedOrientation; r = zedOrientation;
if (enableFixed)
{
zedRigDisplayer.transform.localRotation = camLeft.transform.rotation;
}
else
{
zedRigDisplayer.transform.localRotation = r; //(Mod) zedRigDisplayer should move/rotate the image plane zedRigDisplayer.transform.localRotation = r; //(Mod) zedRigDisplayer should move/rotate the image plane
//zedRigDisplayer.transform.localEulerAngles = new Vector3(r.x,r.y,0); //zedRigDisplayer.transform.localEulerAngles = new Vector3(r.x,r.y,0);
}
//Fixed
@ -1947,7 +1964,7 @@ public class ZEDManager : MonoBehaviour
//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);
camRigDisplayer.transform.localRotation = Quaternion.identity; //camRigDisplayer.transform.localRotation = Quaternion.identity; //asdf
/*if (Input.GetKeyDown("space")) /*if (Input.GetKeyDown("space"))
{ //Restoring position does currently not work { //Restoring position does currently not work
Debug.Log("fix"); Debug.Log("fix");
@ -1976,15 +1993,13 @@ public class ZEDManager : MonoBehaviour
} }
//if (zLockZED) if (zLockZED)
if (true)
{ {
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 (ZLockCam) if (ZLockCam)
if (false)
{ {
//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+