add fixed (simple videogoggle) mode

This commit is contained in:
Philipp Kramer 2020-01-24 10:43:12 +01:00
parent 48406bb9dd
commit b40f00bcf8
1 changed files with 26 additions and 11 deletions

View File

@ -225,9 +225,8 @@ public class ZEDManager : MonoBehaviour
[HideInInspector]
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>
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)
return;
@ -1884,10 +1893,18 @@ public class ZEDManager : MonoBehaviour
//Rotate Image plane with zed rotation
r = zedOrientation;
zedRigDisplayer.transform.localRotation = r; //(Mod) zedRigDisplayer should move/rotate the image plane
//zedRigDisplayer.transform.localEulerAngles = new Vector3(r.x,r.y,0);
if (enableFixed)
{
zedRigDisplayer.transform.localRotation = camLeft.transform.rotation;
}
else
{
zedRigDisplayer.transform.localRotation = r; //(Mod) zedRigDisplayer should move/rotate the image plane
//zedRigDisplayer.transform.localEulerAngles = new Vector3(r.x,r.y,0);
}
//Fixed
//camLeft.transform.SetParent(zedRigDisplayer.transform); //(Mod)
@ -1947,7 +1964,7 @@ public class ZEDManager : MonoBehaviour
//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"))
{ //Restoring position does currently not work
Debug.Log("fix");
@ -1976,15 +1993,13 @@ public class ZEDManager : MonoBehaviour
}
//if (zLockZED)
if (true)
if (zLockZED)
{
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 (ZLockCam)
if (false)
if (ZLockCam)
{
//same for camera Z rotation compensation
Vector3 hmdDirection = new Vector3(0, 0, 1); //Create Vector towars Z+