add blackout fade toggle
This commit is contained in:
parent
fb2c379ccf
commit
da089723aa
1 changed files with 28 additions and 6 deletions
|
@ -66,6 +66,7 @@ public class ZEDManager : MonoBehaviour
|
|||
/// </summary>
|
||||
public sl.ZEDCamera zedCamera = null;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////// Camera Settings ///////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1368,6 +1369,7 @@ public class ZEDManager : MonoBehaviour
|
|||
//Create the spatial mapping module object (even if not used necessarly)
|
||||
spatialMapping = new ZEDSpatialMapping(transform, this);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1841,7 +1843,7 @@ public class ZEDManager : MonoBehaviour
|
|||
|
||||
|
||||
|
||||
|
||||
private int blackoutToggleSpeed = 0;
|
||||
/// <summary>
|
||||
/// Gets the tracking position from the ZED and updates zedRigRoot's position. Also updates the AR tracking if enabled.
|
||||
/// Only called in Live (not SVO playback) mode. Called in Update().
|
||||
|
@ -1860,7 +1862,7 @@ public class ZEDManager : MonoBehaviour
|
|||
|
||||
if (UnityEngine.XR.XRDevice.isPresent && isStereoRig) //AR pass-through mode.
|
||||
{
|
||||
|
||||
|
||||
if (calibrationHasChanged) //If the HMD offset calibration file changed during runtime.
|
||||
{
|
||||
AdjustZEDRigCameraPosition(); //Re-apply the ZED's offset from the VR headset.
|
||||
|
@ -1883,8 +1885,8 @@ public class ZEDManager : MonoBehaviour
|
|||
r = zedOrientation;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1943,15 +1945,34 @@ public class ZEDManager : MonoBehaviour
|
|||
// # Versuch Z Rotation der ZED transformiert auf Rotation des camRig uebertragen #
|
||||
//rotationTransformhelper.transform.rotation = zedRigDisplayer.transform.localRotation;
|
||||
//rotationTransformhelper.transform.localEulerAngles = new Vector3(-zedRigDisplayer.transform.eulerAngles.x, -zedRigDisplayer.transform.eulerAngles.y, 0);
|
||||
|
||||
|
||||
|
||||
camRigDisplayer.transform.localRotation = Quaternion.identity;
|
||||
if (Input.GetKeyDown("space"))
|
||||
/*if (Input.GetKeyDown("space"))
|
||||
{ //Restoring position does currently not work
|
||||
Debug.Log("fix");
|
||||
//camRigDisplayer.transform.localRotation = zedRigDisplayer.transform.rotation; //moves camera image to origin (not view point)
|
||||
camRigDisplayer.transform.localRotation = zedRigDisplayer.transform.rotation;
|
||||
camRigDisplayer.transform.Rotate(-camLeft.transform.rotation.eulerAngles);
|
||||
}*/
|
||||
if (Input.GetKeyDown("space")) //Tollge Blackout
|
||||
{
|
||||
blackoutToggleSpeed = CameraBrightness < 50 ? blackoutToggleSpeed = 1 : blackoutToggleSpeed = -1; //set speed direction
|
||||
}
|
||||
if (blackoutToggleSpeed!=0) //fade running
|
||||
{
|
||||
|
||||
CameraBrightness += blackoutToggleSpeed;
|
||||
if (CameraBrightness >= 100)
|
||||
{
|
||||
CameraBrightness = 100;
|
||||
blackoutToggleSpeed = 0; //stop fade
|
||||
}
|
||||
if (CameraBrightness <= 0)
|
||||
{
|
||||
CameraBrightness = 0;
|
||||
blackoutToggleSpeed = 0; //stop fade
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1992,6 +2013,7 @@ public class ZEDManager : MonoBehaviour
|
|||
else //The ZED is not tracked by itself or an HMD.
|
||||
isCameraTracked = false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Stores the HMD's current pose. Used in AR mode for latency compensation.
|
||||
|
|
Loading…
Reference in a new issue