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.

88 lines
3.1 KiB

  1. // Daydream Boundaries|SDK_Daydream|005
  2. namespace VRTK
  3. {
  4. #if VRTK_DEFINE_SDK_DAYDREAM
  5. using UnityEngine;
  6. #endif
  7. /// <summary>
  8. /// The Daydream Boundaries SDK script provides dummy functions for the play area boundaries.
  9. /// </summary>
  10. [SDK_Description(typeof(SDK_DaydreamSystem))]
  11. public class SDK_DaydreamBoundaries
  12. #if VRTK_DEFINE_SDK_DAYDREAM
  13. : SDK_BaseBoundaries
  14. #else
  15. : SDK_FallbackBoundaries
  16. #endif
  17. {
  18. #if VRTK_DEFINE_SDK_DAYDREAM
  19. private Transform area;
  20. /// <summary>
  21. /// The InitBoundaries method is run on start of scene and can be used to initialse anything on game start.
  22. /// </summary>
  23. public override void InitBoundaries()
  24. {
  25. }
  26. /// <summary>
  27. /// The GetPlayArea method returns the Transform of the object that is used to represent the play area in the scene.
  28. /// </summary>
  29. /// <returns>A transform of the object representing the play area in the scene.</returns>
  30. public override Transform GetPlayArea()
  31. {
  32. if (area == null)
  33. {
  34. Transform foundCamera = (Camera.main != null ? Camera.main.transform : null); //assume main camera is child of camera rig, using native vr
  35. area = (foundCamera != null && foundCamera.parent != null ? foundCamera.parent : foundCamera);
  36. }
  37. return area;
  38. }
  39. /// <summary>
  40. /// The GetPlayAreaVertices method returns the points of the play area boundaries.
  41. /// </summary>
  42. /// <returns>A Vector3 array of the points in the scene that represent the play area boundaries.</returns>
  43. public override Vector3[] GetPlayAreaVertices()
  44. {
  45. return null;
  46. }
  47. /// <summary>
  48. /// The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
  49. /// </summary>
  50. /// <returns>The thickness of the drawn border.</returns>
  51. public override float GetPlayAreaBorderThickness()
  52. {
  53. return 0.1f;
  54. }
  55. /// <summary>
  56. /// The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
  57. /// </summary>
  58. /// <returns>Returns true if the play area size has been auto calibrated and set by external sensors.</returns>
  59. public override bool IsPlayAreaSizeCalibrated()
  60. {
  61. return true;
  62. }
  63. /// <summary>
  64. /// The GetDrawAtRuntime method returns whether the given play area drawn border is being displayed.
  65. /// </summary>
  66. /// <returns>Returns true if the drawn border is being displayed.</returns>
  67. public override bool GetDrawAtRuntime()
  68. {
  69. return false;
  70. }
  71. /// <summary>
  72. /// The SetDrawAtRuntime method sets whether the given play area drawn border should be displayed at runtime.
  73. /// </summary>
  74. /// <param name="value">The state of whether the drawn border should be displayed or not.</param>
  75. public override void SetDrawAtRuntime(bool value)
  76. {
  77. }
  78. #endif
  79. }
  80. }