add blackout fade toggle

This commit is contained in:
Philipp Kramer 2020-01-13 10:42:27 +01:00
parent fb2c379ccf
commit da089723aa

View file

@ -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().
@ -1946,12 +1948,31 @@ public class ZEDManager : MonoBehaviour
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
}
}
@ -1993,6 +2014,7 @@ public class ZEDManager : MonoBehaviour
isCameraTracked = false;
}
/// <summary>
/// Stores the HMD's current pose. Used in AR mode for latency compensation.
/// Pose will be applied to final canvases when a new image's timestamp matches