Classes and Components Overview
When you first open your project based on the VR Template and see a lot of different classes and components, you might get confused a bit. So, let's learn a bit more about the template structure. All components that implement the basic VR functionality are assigned to the corresponding nodes organized in the hierarchy with the vr_layer root node (see the picture below):
VRPlayer Component#
A player is represented by the hierarchy of nodes with the vr_player node in the root (a Player Dummy camera), to which the VRPlayer component is assigned. The component implements the player's logic. The child nodes of vr_player represent models of HMDs and controllers, to which all necessary components are assigned to configure interactions and main parameters.
InputSystem Component#
InputSystem is the main component that implements operations on user input, it includes all available devices, controllers, controls (controllers + common ones), event handlers, an so on. Input parameters for devices, functionality for polling the status of controls, etc. are implemented in the corresponding classes (PCInput, VRInput).
HeadController and HandController Components#
Functionality of the devices is implemented in the components inhertied from the HeadController (for HMDs) and HandController (for controllers) base components:
- VRHeadController and VRHandController components for the VR mode.
- PCHeadController and PCHandController components for the VR-emulation mode with keyboard control.
VRMovementManager Component#
The VRMovementManager component is used for movement management. Different types of movements (rotating, walking, teleporting) are implemented in the components inherited from the base VRBaseMovement component (TurnMovement, WalkMovement, TeleportationMovement + implementation of movements for the VR-emulation mode with keyboard control).
VRInteractionManager Component#
The VRInteractionManager component is used for interactions management. Different types of interactions are implemented in the components inherited from the base VRBaseInteraction component:
- VRHandMenuInteraction - interaction with the menu using controllers
- VRHandShapeInteraction - interaction with objects using controllers and the keyboard
- VRPCHeadMenuInteraction - interaction with the menu for the VR-emulation mode with keyboard control
VRBaseInteractable Component#
VRBaseInteractable is a base component for all interactive objects (objects you can interact with). It defines the main interactions: here you specify the available actions with the object. You can also add your own interaction type.
The following components are inherited from VRBaseInteractable:
VRTransformMovableObject | This component type can be used for all objects that can be grabbed, held, and thrown (it can be a ball, a pistol, whatever you can take, carry and drop). |
---|---|
VRKinematicMovableObject | This component type can be used for physical objects that can be grabbed, held, and thrown (it can be a ball, a pistol, whatever you can take, carry and drop). |
VRPhysicMovableObject | This component type can be used for physical objects with rigid bodies (Rigid Body) that can be grabbed, held, and thrown (it can be a ball, a pistol, whatever you can take, carry and drop). |
VRObjectHandle | This component type can be used for all objects that can be turned or moved while being held (various handles, levers, valves, etc.). |
VRObjectSwitch | This component type can be used for all objects that can be switched by grabbing (all sorts of buttons and on-off switches, including rotary ones). It can be used in combination with the VRNodeSwitchEnableByGrab component for additional effects. |
VRNodeSwitchEnableByGrab | This component type is used to control enabling/disabling of one or more nodes when grabbed. |
VRLaserPointer | This component enables casting a laser ray by the object. The laser pointer node has 2 components assigned: VRTransformMovableObject and VRLaserPointer. |