Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1.0 KiB

  1. namespace VRTK
  2. {
  3. using UnityEngine;
  4. #if UNITY_2017_2_OR_NEWER
  5. using UnityEngine.XR;
  6. #else
  7. using XRDevice = UnityEngine.VR.VRDevice;
  8. #endif
  9. /// <summary>
  10. /// The `[UnityBase_CameraRig]` prefab is a default camera rig set up for use with the Unity SDK support.
  11. /// </summary>
  12. /// <remarks>
  13. /// The Unity CameraRig also utilises the Unity Controller Tracker and Headset Tracker to enable GameObject tracking of it's position/rotation to the available connected VR device via the `UnityEngine.VR` library.
  14. /// </remarks>
  15. public class SDK_UnityCameraRig : MonoBehaviour
  16. {
  17. [Tooltip("Automatically set the Unity Physics Fixed Timestep value based on the HMD render frequency.")]
  18. public bool lockPhysicsUpdateRateToRenderFrequency = true;
  19. protected virtual void Update()
  20. {
  21. if (lockPhysicsUpdateRateToRenderFrequency && Time.timeScale > 0.0f)
  22. {
  23. Time.fixedDeltaTime = Time.timeScale / XRDevice.refreshRate;
  24. }
  25. }
  26. }
  27. }