Component Structure
The VR Add-On is a collection of scripts that sit on top of the existing character controller structure. Most of the included scripts are new abilities but there are a few scripts which are independent of the ability system:
Movement Types
The First Person VR Movement Type is designed to be used with a two-handed tracking system (such as the Rift or Vive). It allows for input to be blocked which then allows other abilities (such as the Teleporter) to do the character movement. Any of the existing third person movement types can be used for a third person VR character.
View Types
The First Person VR View Type recognizes the VR camera as a child of the main Camera Controller GameObject. This view type will recenter the VR camera when the character teleports to a new location. Any of the existing third person view types can be used for a third person VR character.
Hand Tracking
If the first person character is setup to be used with a two-handed tracking system then the Hand Handler component will be added to character GameObject. This component moves the Hand GameObjects to the same location as the player’s physical hands. For single controller headsets (such as the Oculus Go) the Hand Tracker component will rotate the First Person Objects GameObject to be at the same angle as the player’s hand.
Items
The logic for the item system is very similar for VR characters as it is for non-VR characters. The two exceptions are the melee and throwable items. When these items are updated (through the Item Setup editor) the VR Melee Weapon and VR Throwable Item components will be added. These components track the hand velocity so it knows how much force to apply to the object when it is used.
UI
The UI for VR games uses a world space canvas rather than the traditional screen space canvas. To account for this the Follow VR Camera Canvas component will move the world space canvas to be located in front of the VR camera. When this component is initialized it will search through all of the child UI Graphic components and change their material’s unity_GUIZTestMode to Always render.