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.

194 lines
8.2 KiB

  1. ## Daydream SDK for VRTK
  2. _Jonathan Linowes (@linojon)_
  3. The Daydream SDK for VRTK integrates the Daydream platform with VRTK. It can use Unity's built-in VR supported Camera with Daydream support.
  4. Daydream controllers are signficantly limited compared with positionally tracked hand controllers like HTC Vive Lighthouse and Oculus Rift Touch.
  5. The Daydream controller hardware provides 3 DOF (x y z axis rotation) and accellerometer. However, some (limited) 3-space positioning can be simulated. The Google VR (Gvr) SDK provides an Arm Model that simulates transforms for shoulder, elbow, wrist and pointer joints. Your application can still use these with VRTK, just supply an object with the GvrArmModelOffsets component to the VRTK_LinkedObjects, VRTK_SimplerPointer or other appropriate component.
  6. Further, this VRTK Daydream SDK provides a DaydreamReach component to facilitate reaching out to touch and grab. It uses the touchpad to push the controller position out in front of user along the current orientation plane or pointer axis.
  7. ### Pre-requisites
  8. For first time users, see the Unity docs [Getting started with Android development](https://docs.unity3d.com/Manual/android-GettingStarted.html) and Google documentation [Get Started Guides for Android Daydream](https://developers.google.com/vr/unity/get-started-controller). In particular,
  9. * Use a version of Unity that natively support Google VR with Daydream (as of Jan 30, 2017, 5.4.2f2-GVR13 [Daydream technical preview](https://unity3d.com/partners/google/daydream#section-download). Note Unity 5.6.0b4 build is not stable with thie SDK). Install with "Android Build Support"
  10. * If this is your first time developing Android applications in Unity, follow Unity's [Android SDK setup](https://docs.unity3d.com/Manual/android-sdksetup.html)
  11. * Download the [Google VR SDK for Unity](https://developers.google.com/vr/unity/download#google-vr-sdk-for-unity)
  12. * You'll need [Daydream hardware](https://developers.google.com/vr/daydream/hardware) to run your app, including a Daydream-ready phone and Daydream headset (Note, I use a Nexus 6P running Nougat, although not offically Daydream ready, it does work with some complaining)
  13. * A second Android phone with the [Controller Emulator](https://developers.google.com/vr/daydream/controller-emulator)
  14. ### Setup
  15. Instructions for setting up your Unity project for Daydream with VRTK. Uses the integrated support for Google Daydream VR camera object.
  16. * Open a new or existing project in Unity (5.4.2f2-GVR13 or other version with Daydream integration)
  17. * Import asset package GoogleVRForUnity you downloaded from Google
  18. * Build Settings:
  19. * Target platform: Android
  20. * Player settings:
  21. * Virtual Reality Supported > Daydream
  22. * API Level: Nougat
  23. * Bundle Identifier and other settings you'd use to run on Android
  24. * In Hierarchy, create empty, named "DaydreamCameraRig"
  25. * Move or create a Camera as child of DaydreamCameraRig, reset its transform (position 0,0,0)
  26. * Add GvrControllerPointer prefab from Assets/GoogleVR/Prefabs/UI
  27. * Add GvrControllerMain prefab from Assets/GoogleVR/Prefabs/Controller/
  28. * Add GvrViewerMain prefab (enables view in editor play mode)
  29. * Disable Daydream's native pointer tools
  30. * To the Camera object, disable or remove GvrPointerPhysicsRaycaster component, if present
  31. * To the GvrControllerPointer/Laser, disable or delete
  32. ### Setup VRTK Components
  33. * In Hierarchy, create an Empty named "[VRTK]"
  34. * Add component VRTK_SDKManager
  35. * Add a child Empty named "RightController"
  36. * Note, Daydream supports only one controller, LeftController will not be used. If present, can be disabled or deleted.
  37. * SDK Selection
  38. * In Inspector, choose Quick Select SDK: Daydream
  39. * that should populate the four SDKs,
  40. * In Player Settings, ensure Scripting Define Symbols: VRTK_SDK_DAYDREAM
  41. * Linked Objects:
  42. * Click "Auto Populate Linked Objects", that should set:
  43. * Actual Boundaries: DaydreamCameraRig
  44. * Actual Headset: DaydreamCameraRig/Camera
  45. * Actual Left Controller: empty
  46. * Actual Right Controller: DaydreamCameraRig/GvrControllerPointer/Controller
  47. * Controler Aliases:
  48. * Model Alias Left Controller: empty
  49. * Model Alias Right Controller: DaydreamCameraRig/GvrControllerPoints/Controller
  50. * Script Alias Left Controller: empty
  51. * Script Alias Right Controller: [VRTK]/RightController
  52. ## Tips
  53. * Note, we're using the name "RightController" to follow VRTK convention. However, it's a Daydream device setting whether the controller is rendered as held in the player's right or left hand. But normally players will have just one controller.
  54. * I recommend enabling Use Accelerometer in GrvControllerMain for more natural hand tracking.
  55. * You can change the Controller's GvrArmModelOffsets Joint to Elbow for more exaggerated (amplified) motions
  56. * Optionally, in Hierarchy add the following prefabs,
  57. * GvrFPSCanvas (to see the frames per second rate)
  58. * DemoInputManager (to see the controller connection status)
  59. ### VRTK Controller Components
  60. Depending on which components you're using on the [VRTK]/RightController, you might want to make the following adjustments.
  61. * VRTK_ControllerEvents: suggested Action Alias Buttons:
  62. * Pointer Toggle Button: Touchpad_Touch
  63. * Pointer Set Button: Touchpad_Touch
  64. * Grab Toggle Button: Touchpad_Press
  65. * Use Toggle Button: Touchpad_Press
  66. * UI Click Button: Touchpad_Press
  67. * Menu Toggle Button: Button_One_Press
  68. * VRTK_SimplePointer:
  69. * PointOriginTransform: drag in the GvrControllerPointer/Laser object, which has the Point joint (instead of Controller which has the Wrist joint) or other object using Pointer joint
  70. * (Note: Pointer Tilt Angle is set in GvrControllerMain's GvrArmModel component)
  71. ### VRTK Event Support
  72. The following shows the events supported directly by the VRTK Daydream SDK. Other events, such as Trigger_Press, if needed should be set in the controller Action Alias Buttons.
  73. **Supported**
  74. * Touchpad_Touch
  75. * Touchpad_Press
  76. * Button_One_Press
  77. **Ignored**
  78. * Trigger_Hairline
  79. * Trigger_Touch
  80. * Trigger_Press
  81. * Trigger_Click
  82. * Grip_Hairline
  83. * Grip_Touch
  84. * Grip_Press
  85. * Grip_Click
  86. * Button_One_Touch
  87. * Button_Two_Touch
  88. * Button_One_Press
  89. * Start_Menu_Press
  90. ### VRTK SDK Support
  91. The following shows the API methods supported directly by the VRTK Daydream SDK.
  92. **Supported**
  93. * GetControllerDefaultColliderPath
  94. * GetControllerElementPath
  95. * GetControllerIndex
  96. * GetControllerByIndex
  97. * GetControllerOrigin
  98. * GenerateControllerPointerOrigin
  99. * GetControllerRightHand
  100. * GetControllerModel
  101. * GetControllerRenderModel
  102. * GetVelocityOnIndex
  103. * GetAngularVelocityOnIndex
  104. * GetTouchpadAxisOnIndex
  105. * IsTouchpadPressedOnIndex
  106. * IsTouchpadPressedDownOnIndex
  107. * IsTouchpadPressedUpOnIndex
  108. * IsTouchpadTouchedOnIndex
  109. * IsTouchpadTouchedDownOnIndex
  110. * IsTouchpadTouchedUpOnIndex
  111. * IsButtonOnePressedOnIndex
  112. * IsButtonOnePressedDownOnIndex
  113. * IsButtonOnePressedUpOnIndex
  114. **Ignored**
  115. Uses Fallback methods, usually returning false or null.
  116. * GetControllerLeftHand
  117. * IsControllerLeftHand
  118. * SetControllerRenderModelWheel
  119. * HapticPulseOnIndex
  120. * GetHapticModifiers
  121. * GetTriggerAxisOnIndex
  122. * GetGripAxisOnIndex
  123. * GetTriggerHairlineDeltaOnIndex
  124. * GetGripHairlineDeltaOnIndex
  125. * IsTriggerPressedOnIndex
  126. * IsTriggerPressedDownOnIndex
  127. * IsTriggerPressedUpOnIndex
  128. * IsTriggerTouchedOnIndex
  129. * IsTriggerTouchedDownOnIndex
  130. * IsTriggerTouchedUpOnIndex
  131. * IsHairTriggerDownOnIndex
  132. * IsHairTriggerUpOnIndex
  133. * IsGripPressedOnIndex
  134. * IsGripPressedDownOnIndex
  135. * IsGripPressedUpOnIndex
  136. * IsGripTouchedOnIndex
  137. * IsGripTouchedDownOnIndex
  138. * IsGripTouchedUpOnIndex
  139. * IsHairGripDownOnIndex
  140. * IsHairGripUpOnIndex
  141. * IsButtonOneTouchedOnIndex
  142. * IsButtonOneTouchedDownOnIndex
  143. * IsButtonOneTouchedUpOnIndex
  144. * IsButtonTwoPressedOnIndex
  145. * IsButtonTwoPressedDownOnIndex
  146. * IsButtonTwoPressedUpOnIndex
  147. * IsButtonTwoTouchedOnIndex
  148. * IsButtonTwoTouchedDownOnIndex
  149. * IsButtonTwoTouchedUpOnIndex
  150. * IsStartMenuPressedOnIndex
  151. * IsStartMenuPressedDownOnIndex
  152. * IsStartMenuPressedUpOnIndex
  153. * IsStartMenuTouchedOnIndex
  154. * IsStartMenuTouchedDownOnIndex
  155. * IsStartMenuTouchedUpOnIndex
  156. ### Mobile Considerations
  157. Please consider that VRTK was originally developed for desktop VR in mind. Google Daydream is for Android mobile devices. I do not know to what extent, if any, VRTK has been optimized with mobile VR in mind. I appreciate any feedback, issues, and suggestions to improve this SDK or make VRTK great for mobile.