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.

86 lines
3.2 KiB

  1. // Unity Boundaries|SDK_Unity|004
  2. namespace VRTK
  3. {
  4. using UnityEngine;
  5. /// <summary>
  6. /// The Unity Boundaries SDK script provides a bridge to a default Unity play area.
  7. /// </summary>
  8. [SDK_Description(typeof(SDK_UnitySystem))]
  9. [SDK_Description(typeof(SDK_UnitySystem), 1)]
  10. [SDK_Description(typeof(SDK_UnitySystem), 2)]
  11. [SDK_Description(typeof(SDK_UnitySystem), 3)]
  12. [SDK_Description(typeof(SDK_UnitySystem), 4)]
  13. [SDK_Description(typeof(SDK_UnitySystem), 5)]
  14. public class SDK_UnityBoundaries : SDK_BaseBoundaries
  15. {
  16. /// <summary>
  17. /// The InitBoundaries method is run on start of scene and can be used to initialse anything on game start.
  18. /// </summary>
  19. public override void InitBoundaries()
  20. {
  21. }
  22. /// <summary>
  23. /// The GetPlayArea method returns the Transform of the object that is used to represent the play area in the scene.
  24. /// </summary>
  25. /// <returns>A transform of the object representing the play area in the scene.</returns>
  26. public override Transform GetPlayArea()
  27. {
  28. cachedPlayArea = GetSDKManagerPlayArea();
  29. if (cachedPlayArea == null)
  30. {
  31. GameObject foundCameraRig = VRTK_SharedMethods.FindEvenInactiveGameObject<SDK_UnityCameraRig>(null, true);
  32. if (foundCameraRig != null)
  33. {
  34. cachedPlayArea = foundCameraRig.transform;
  35. }
  36. }
  37. return cachedPlayArea;
  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 false;
  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. }
  79. }