This file describes all of the public methods, variables and events utilised by the VRTK prefabs and scripts.
A collection of pre-defined usable prefabs have been included to allow for each drag-and-drop set up of common elements.
Provides a GUI overlay to allow switching the loaded VRTK_SDKSetup of the the current VRTK_SDKManager.
Prefab Usage:
VRTK/Prefabs/SDKSetupSwitcher/SDKSetupSwitcher
prefab into the scene hierarchy.Adds an in-scene representation of the Unity console on a world space canvas.
Prefab Usage:
VRTK/Prefabs/ConsoleViewerCanvas/ConsoleViewerCanvas
prefab into the scene hierarchy.It is also possible to interact with the
ConsoleViewerCanvas
with aVRTK_UIPointer
.
public virtual void SetCollapse(bool state)
bool state
- The state of whether to collapse the output messages, true will collapse and false will not collapse.The SetCollapse method determines whether the console will collapse same message output into the same line. A state of true
will collapse messages and false
will print the same message for each line.
public virtual void ClearLog()
The ClearLog method clears the current log view of all messages
Provides a frames per second text element to the HMD view. To use the prefab it must be placed into the scene then the headset camera needs attaching to the canvas:
Prefab Usage:
VRTK/Prefabs/FramesPerSecondCanvas/FramesPerSecondCanvas
prefab in the scene hierarchy.This script is largely based on the script at: http://talesfromtherift.com/vr-fps-counter/ So all credit to Peter Koch for his work. Twitter: @peterept
VRTK/Examples/018_CameraRig_FramesPerSecondCounter
displays the frames per second in the centre of the headset view. Pressing the trigger generates a new sphere and pressing the touchpad generates ten new spheres. Eventually when lots of spheres are present the FPS will drop and demonstrate the prefab.
Allows rendering a separate camera that is shown on the desktop only, without changing what's seen in VR headsets.
Prefab Usage:
VRTK/Prefabs/DesktopCamera/DesktopCamera
prefab in the scene.headsetImage
is set a default render texture will be created.Provides a simple trigger collider volume that when a controller enters will enable the rigidbody on the controller.
Prefab Usage:
VRTK/Prefabs/ControllerRigidbodyActivator/ControllerRigidbodyActivator
prefab in the scene at the location where the controller rigidbody should be automatically activated.Is Trigger
).If the prefab is placed as a child of the target Interactable Object then the collider volume on the prefab will trigger collisions on the Interactable Object.
ControllerRigidbodyOn
- Emitted when the controller rigidbody is turned on.ControllerRigidbodyOff
- Emitted when the controller rigidbody is turned off.Adding the VRTK_ControllerRigidbodyActivator_UnityEvents
component to VRTK_ControllerRigidbodyActivator
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
. interactingObject
- The object that touching the activator.Adds a World Space Canvas that can be used to provide additional information about an object by providing a piece of text with a line drawn to a destination point.
Prefab Usage:
VRTK/Prefabs/ObjectTooltip/ObjectTooltip
prefab into the scene hierarchy, preferably as a child of the GameObject it is associated with.Draw Line To
option to the Transform component of the GameObject the Tooltip will be assoicated with.x = width
and y = height
.ObjectTooltipReset
- Emitted when the object tooltip is reset.ObjectTooltipTextUpdated
- Emitted when the object tooltip text is updated.Adding the VRTK_ObjectTooltip_UnityEvents
component to VRTK_ObjectTooltip
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.string newText
- The optional new text that is given to the tooltip.
public virtual void ResetTooltip()
The ResetTooltip method resets the tooltip back to its initial state.
public virtual void UpdateText(string newText)
string newText
- A string containing the text to update the tooltip to display.The UpdateText method allows the tooltip text to be updated at runtime.
VRTK/Examples/029_Controller_Tooltips
displays two cubes that have an object tooltip added to them along with tooltips that have been added to the controllers.
Adds a collection of Object Tooltips to the Controller providing information to what the controller buttons may do.
Prefab Usage:
VRTK/Prefabs/ControllerTooltips/ControllerTooltips
prefab as a child of the relevant controller script alias GameObject in the scene hierarchy.Button Transform Settings
are provided in the inspector at Edit time then the button transforms will attempt to be set to the transforms of the current SDK default controller model.Button Text Settings
text options are not provided, then the tooltip for that specific button will be hidden.There are a number of parameters that can be set on the Prefab which are provided by the
VRTK_ControllerTooltips
script which is applied to the prefab.
ControllerTooltipOn
- Emitted when the controller tooltip is turned on.ControllerTooltipOff
- Emitted when the controller tooltip is turned off.Adding the VRTK_ControllerTooltips_UnityEvents
component to VRTK_ControllerTooltips
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.VRTK_ControllerTooltips.TooltipButtons element
- The tooltip element being affected.
public virtual void ResetTooltip()
The Reset method reinitalises the tooltips on all of the controller elements.
public virtual void UpdateText(TooltipButtons element, string newText)
TooltipButtons element
- The specific controller element to change the tooltip text on.string newText
- A string containing the text to update the tooltip to display.The UpdateText method allows the tooltip text on a specific controller element to be updated at runtime.
public virtual void ToggleTips(bool state, TooltipButtons element = TooltipButtons.None)
bool state
- The state of whether to display or hide the controller tooltips, true will display and false will hide.TooltipButtons element
- The specific element to hide the tooltip on, if it is TooltipButtons.None
then it will hide all tooltips. Optional parameter defaults to TooltipButtons.None
The ToggleTips method will display the controller tooltips if the state is true
and will hide the controller tooltips if the state is false
. An optional element
can be passed to target a specific controller tooltip to toggle otherwise all tooltips are toggled.
VRTK/Examples/029_Controller_Tooltips
displays two cubes that have an object tooltip added to them along with tooltips that have been added to the controllers.
Provides a predefined zone where a valid interactable object can be dropped and upon dropping it snaps to the set snap drop zone transform position, rotation and scale.
Prefab Usage:
VRTK/Prefabs/SnapDropZone/SnapDropZone
prefab into the scene hierarchy.Highlight Object Prefab
to generate an object outline in the scene that determines the final position, rotation and scale of the snapped object.VRTK_BaseHighlighter
derivative is applied to the SnapDropZone then the default MaterialColorSwap Highlighter will be used.Sphere Collider
by default but can be amended or replaced on the SnapDropZone GameObject.Use Joint
Snap Type is selected then a custom Joint component is required to be added to the SnapDropZone
Game Object and upon release the interactable object's rigidbody will be linked to this joint as the Connected Body
.Highlight Always Active
is true.Color.clear
then the Highlight Color
will be used.public enum SnapTypes
- The types of snap on release available.
UseKinematic
- Will set the interactable object rigidbody to isKinematic = true
.UseJoint
- Will attach the interactable object's rigidbody to the provided joint as it's Connected Body
.UseParenting
- Will set the SnapDropZone as the interactable object's parent and set it's rigidbody to isKinematic = true
.ObjectEnteredSnapDropZone
- Emitted when a valid interactable object enters the snap drop zone trigger collider.ObjectExitedSnapDropZone
- Emitted when a valid interactable object exists the snap drop zone trigger collider.ObjectSnappedToDropZone
- Emitted when an interactable object is successfully snapped into a drop zone.ObjectUnsnappedFromDropZone
- Emitted when an interactable object is removed from a snapped drop zone.Adding the VRTK_SnapDropZone_UnityEvents
component to VRTK_SnapDropZone
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.GameObject snappedObject
- The interactable object that is dealing with the snap drop zone.
public virtual void InitaliseHighlightObject(bool removeOldObject = false)
bool removeOldObject
- If this is set to true then it attempts to delete the old highlight object if it exists. Defaults to false
The InitaliseHighlightObject method sets up the highlight object based on the given Highlight Object Prefab.
public virtual void ForceSnap(GameObject objectToSnap)
GameObject objectToSnap
- The GameObject to attempt to snap.the ForceSnap method attempts to automatically attach a valid GameObject to the snap drop zone.
public virtual void ForceUnsnap()
The ForceUnsnap method attempts to automatically remove the current snapped game object from the snap drop zone.
public virtual bool ValidSnappableObjectIsHovering()
bool
- Returns true if a valid object is currently in the snap drop zone area.The ValidSnappableObjectIsHovering method determines if any valid objects are currently hovering in the snap drop zone area.
public virtual bool IsObjectHovering(GameObject checkObject)
GameObject checkObject
- The GameObject to check to see if it's hovering in the snap drop zone area.bool
- Returns true if the given GameObject is hovering (but not snapped) in the snap drop zone area.The IsObjectHovering method determines if the given GameObject is currently howvering (but not snapped) in the snap drop zone area.
public virtual bool IsInteractableObjectHovering(VRTK_InteractableObject checkObject)
VRTK_InteractableObject checkObject
- The Interactable Object script to check to see if it's hovering in the snap drop zone area.bool
- Returns true if the given Interactable Object script is hovering (but not snapped) in the snap drop zone area.The IsInteractableObjectHovering method determines if the given Interactable Object script is currently howvering (but not snapped) in the snap drop zone area.
public virtual List<GameObject> GetHoveringObjects()
List<GameObject>
- The List of valid GameObjects that are hovering (but not snapped) in the snap drop zone area.The GetHoveringObjects method returns a List of valid GameObjects that are currently hovering (but not snapped) in the snap drop zone area.
public virtual List<VRTK_InteractableObject> GetHoveringInteractableObjects()
List<VRTK_InteractableObject>
- The List of valid Interactable Object scripts that are hovering (but not snapped) in the snap drop zone area.The GetHoveringInteractableObjects method returns a List of valid Interactable Object scripts that are currently hovering (but not snapped) in the snap drop zone area.
public virtual GameObject GetCurrentSnappedObject()
GameObject
- The GameObject that is currently snapped in the snap drop zone area.The GetCurrentSnappedObejct method returns the GameObject that is currently snapped in the snap drop zone area.
public virtual VRTK_InteractableObject GetCurrentSnappedInteractableObject()
VRTK_InteractableObject
- The Interactable Object script that is currently snapped in the snap drop zone area.The GetCurrentSnappedInteractableObject method returns the Interactable Object script that is currently snapped in the snap drop zone area.
public virtual GameObject Clone(Vector3 position)
Vector3 position
- Position of the cloned GameObjectGameObject
- The GameObject of the cloneThe Clone method returns the GameObject of the cloned snap drop zone
public virtual GameObject Clone()
GameObject
- The GameObject of the cloneThe Clone method returns the GameObject of the cloned snap drop zone
VRTK/Examples/041_Controller_ObjectSnappingToDropZones
uses the VRTK_SnapDropZone
prefab to set up pre-determined snap zones for a range of objects and demonstrates how only objects of certain types can be snapped into certain areas.
extends VRTK_DestinationMarker
Allows for a specific scene marker or specific area within the scene that can be teleported to.
Prefab Usage:
VRTK/Prefabs/DestinationPoint/DestinationPoint
prefab at the desired location within the scene.Enable Teleport
checkbox to lock the destination point and prevent teleporting to it.Snap To Point
checkbox to provide a destination area rather than a specific point to teleport to.public enum RotationTypes
- Allowed snap to rotation types.
NoRotation
- No rotation information will be emitted in the destination set payload.RotateWithNoHeadsetOffset
- The destination point's rotation will be emitted without taking into consideration the current headset rotation.RotateWithHeadsetOffset
- The destination point's rotation will be emitted and will take into consideration the current headset rotation.DestinationPointEnabled
- Emitted when the destination point is enabled.DestinationPointDisabled
- Emitted when the destination point is disabled.DestinationPointLocked
- Emitted when the destination point is locked.DestinationPointUnlocked
- Emitted when the destination point is unlocked.DestinationPointReset
- Emitted when the destination point is reset.Adding the VRTK_DestinationPoint_UnityEvents
component to VRTK_DestinationPoint
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.
public virtual void ResetDestinationPoint()
The ResetDestinationPoint resets the destination point back to the default state.
044_CameraRig_RestrictedTeleportZones
uses the VRTK_DestinationPoint
prefab to set up a collection of pre-defined teleport locations.
Adds a Pointer Direction Indicator to a pointer renderer and determines a given world rotation that can be used by a Destiantion Marker.
Prefab Usage:
VRTK/Prefabs/PointerDirectionIndicator/PointerDirectionIndicator
prefab into the scene hierarchy.PointerDirectionIndicator
scene GameObejct to the Direction Indicator
inspector parameter on a VRTK_BasePointerRenderer
component.This can be useful for rotating the play area upon teleporting to face the user in a new direction without expecting them to physically turn in the play space.
public enum VisibilityState
- States of Direction Indicator Visibility.
OnWhenPointerActive
- Only shows the direction indicator when the pointer is active.AlwaysOnWithPointerCursor
- Only shows the direction indicator when the pointer cursor is visible or if the cursor is hidden and the pointer is active.PointerDirectionIndicatorPositionSet
- Emitted when the object tooltip is reset.Adding the VRTK_PointerDirectionIndicator_UnityEvents
component to VRTK_PointerDirectionIndicator
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.
public virtual void Initialize(VRTK_ControllerEvents events)
VRTK_ControllerEvents events
- The Controller Events script that is used to control the direction indicator's rotation.The Initialize method is used to set up the direction indicator.
public virtual void SetPosition(bool active, Vector3 position)
bool active
- Determines if the direction indicator GameObject should be active or not.Vector3 position
- The position to set the direction indicator to.The SetPosition method is used to set the world position of the direction indicator.
public virtual Quaternion GetRotation()
Quaternion
- The reported rotation of the direction indicator.The GetRotation method returns the current reported rotation of the direction indicator.
public virtual void SetMaterialColor(Color color, bool validity)
Color color
- The colour to update the direction indicatormaterial to.bool validity
- Determines if the colour being set is based from a valid location or invalid location.The SetMaterialColor method sets the current material colour on the direction indicator.
public virtual VRTK_ControllerEvents GetControllerEvents()
VRTK_ControllerEvents
- The associated Controller Events script.The GetControllerEvents method returns the associated Controller Events script with the Pointer Direction Indicator script.
Provides a UI element into the world space that can be dropped into a Controller GameObject and used to create and use Radial Menus from the touchpad.
Prefab Usage:
VRTK/Prefabs/RadialMenu/RadialMenu
prefab as a child of a Controller script alias GameObject.
public TouchAngleDeflection(float angle, float deflection)
float angle
- The angle of the touch on the radial menu.float deflection
- Deflection of the touch, where 0 is the centre and 1 is the edge.Constructs an object to hold the angle and deflection of the user's touch on the touchpad
public virtual void HoverButton(TouchAngleDeflection givenTouchAngleDeflection)
TouchAngleDeflection givenTouchAngleDeflection
- The angle and deflection on the radial menu.The HoverButton method is used to set the button hover at a given angle and deflection.
public virtual void ClickButton(TouchAngleDeflection givenTouchAngleDeflection)
TouchAngleDeflection givenTouchAngleDeflection
- The angle and deflection on the radial menu.The ClickButton method is used to set the button click at a given angle and deflection.
public virtual void UnClickButton(TouchAngleDeflection givenTouchAngleDeflection)
TouchAngleDeflection givenTouchAngleDeflection
- The angle and deflection on the radial menu.The UnClickButton method is used to set the button unclick at a given angle and deflection.
public virtual void ToggleMenu()
The ToggleMenu method is used to show or hide the radial menu.
public virtual void StopTouching()
The StopTouching method is used to stop touching the menu.
public virtual void ShowMenu()
The ShowMenu method is used to show the menu.
public virtual RadialMenuButton GetButton(int id)
int id
- The id of the button to retrieve.RadialMenuButton
- The found radial menu button.The GetButton method is used to get a button from the menu.
public virtual void HideMenu(bool force)
bool force
- If true then the menu is always hidden.The HideMenu method is used to hide the menu.
public void RegenerateButtons()
The RegenerateButtons method creates all the button arcs and populates them with desired icons.
public void AddButton(RadialMenuButton newButton)
RadialMenuButton newButton
- The button to add.The AddButton method is used to add a new button to the menu.
VRTK/Examples/030_Controls_RadialTouchpadMenu
displays a radial menu for each controller. The left controller uses the Hide On Release
variable, so it will only be visible if the left touchpad is being touched. It also uses the Execute On Unclick
variable to delay execution until the touchpad button is unclicked. The example scene also contains a demonstration of anchoring the RadialMenu to an interactable cube instead of a controller.
extends VRTK_RadialMenuController
Allows the RadialMenu to be anchored to any object, not just a controller.
Prefab Usage:
VRTK/Prefabs/RadialMenu/RadialMenu
prefab as a child of the GameObject to associate the Radial Menu with.RadialMenu
empty.VRTK_RadialMenuController
with VRTK_IndependentRadialMenuController
that is located on the RadialMenu/RadialMenuUI/Panel
GameObject.VRTK_InteractableObject
script.Is Usable
and Hold Button to Use
are both checked on the VRTK_InteractableObject
.VRTK_InteractTouch
and VRTK_InteractUse
scripts to the objects that will activate the Radial Menu (e.g. the Controllers).
public virtual void UpdateEventsManager()
The UpdateEventsManager method is used to update the events within the menu controller.
VRTK/Examples/030_Controls_RadialTouchpadMenu
displays a radial menu for each controller. The left controller uses the Hide On Release
variable, so it will only be visible if the left touchpad is being touched. It also uses the Execute On Unclick
variable to delay execution until the touchpad button is unclicked. The example scene also contains a demonstration of anchoring the RadialMenu to an interactable cube instead of a controller.
Adds a top-level controller to handle the display of up to four child PanelMenuItemController items which are displayed as a canvas UI panel.
Prefab Usage:
VRTK/Prefabs/PanelMenu/PanelMenu
prefab as a child of the VRTK_InteractableObject
the panel menu is for.PanelTopControls
.VRTK_PanelMenuController
script to determine which panel control menu items are available.
public virtual void ToggleMenu()
The ToggleMenu method is used to show or hide the menu.
public virtual void ShowMenu()
The ShowMenu method is used to show the menu.
public virtual void HideMenu(bool force)
bool force
- If true then the menu is always hidden.The HideMenu method is used to hide the menu.
public virtual void HideMenuImmediate()
The HideMenuImmediate method is used to immediately hide the menu.
040_Controls_Panel_Menu
contains three basic interactive object examples of the PanelMenu in use.
Intercepts the controller events sent from a VRTK_PanelMenuController
and passes them onto additional custom event subscriber scripts, which then carry out the required custom UI actions.
This script is not directly part of a prefab but is a helper associated to the
PanelMenu
prefab.
VRTK/Prefabs/PanelMenu/VRTK_PanelMenuItemController
script on the child GameObject of any Panel Item Container which is contained within the PanelMenuController
prefab within the scene.PanelMenuItemShowing
- Emitted when the panel menu item is showing.PanelMenuItemHiding
- Emitted when the panel menu item is hiding.PanelMenuItemSwipeLeft
- Emitted when the panel menu item is open and the user swipes left on the controller touchpad.PanelMenuItemSwipeRight
- Emitted when the panel menu item is open and the user swipes right on the controller touchpad.PanelMenuItemSwipeTop
- Emitted when the panel menu item is open and the user swipes top on the controller touchpad.PanelMenuItemSwipeBottom
- Emitted when the panel menu item is open and the user swipes bottom on the controller touchpad.PanelMenuItemTriggerPressed
- Emitted when the panel menu item is open and the user presses the trigger of the controller holding the interactable object.GameObject interactableObject
- The GameObject for the interactable object the PanelMenu is attached to.
public virtual PanelMenuItemControllerEventArgs SetPanelMenuItemEvent(GameObject interactableObject)
GameObject interactableObject
- The object the menu is attached to.PanelMenuItemControllerEventArgs
- The payload for the event.The SetPanelMenuItemEvent is used to build up the event payload.
public virtual void Show(GameObject interactableObject)
GameObject interactableObject
- The object the menu is attached to.The Show method is used to show the menu.
public virtual void Hide(GameObject interactableObject)
GameObject interactableObject
- The object the menu is attached to.The Hide method is used to show the menu.
public virtual void SwipeLeft(GameObject interactableObject)
GameObject interactableObject
- The object the menu is attached to.The SwipeLeft method is used when the control is swiped left.
public virtual void SwipeRight(GameObject interactableObject)
GameObject interactableObject
- The object the menu is attached to.The SwipeRight method is used when the control is swiped right.
public virtual void SwipeTop(GameObject interactableObject)
GameObject interactableObject
- The object the menu is attached to.The SwipeTop method is used when the control is swiped up.
public virtual void SwipeBottom(GameObject interactableObject)
GameObject interactableObject
- The object the menu is attached to.The SwipeBottom method is used when the control is swiped down.
public virtual void TriggerPressed(GameObject interactableObject)
GameObject interactableObject
- The object the menu is attached to.The TriggerPressed method is used when the control action button is pressed.
040_Controls_Panel_Menu
contains three basic interactive object examples of the PanelMenu in use.
Provides a custom controller hand model with psuedo finger functionality.
Prefab Usage:
VRTK/Prefabs/AvatarHands/BasicHands/VRTK_BasicHand
prefab as a child of either the left or right script alias.Mirror Model
parameter.Digital
.Digital
.Digital
.Digital
.Digital
.Digital
.Digital
.Model
will be searched for to use as the Transform.public enum ApplyOverrideType
- Determine when to apply the override.
Never
- Never apply the override.Always
- Always apply the override.DigitalState
- Only apply the override when the state is set to digital.AxisState
- Only apply the override when the state is set to axis.SenseAxisState
- Only apply the override when the state is set to sense axis.AxisAndSenseAxisState
- Only apply the override when the state is set to axis or sense axis.032_Controller_CustomControllerModel
uses the VRTK_BasicHand
prefab to display custom avatar hands for the left and right controller.
A collection of scripts that provide the ability to create pointers and set destination markers in the scene.
Provides a base that all destination markers can inherit from.
Script Usage:
This is an abstract class that is to be inherited to a concrete class that provides object control action functionality, therefore this script should not be directly used.
DestinationMarkerEnter
- Emitted when a collision with another collider has first occurred.DestinationMarkerExit
- Emitted when the collision with the other collider ends.DestinationMarkerSet
- Emitted when the destination marker is active in the scene to determine the last destination position (useful for selecting and teleporting).Adding the VRTK_DestinationMarker_UnityEvents
component to VRTK_DestinationMarker
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.float distance
- The distance between the origin and the collided destination.Transform target
- The Transform of the collided destination object.RaycastHit raycastHit
- The optional RaycastHit generated from when the ray collided.Vector3 destinationPosition
- The world position of the destination marker.Quaternion? destinationRotation
- The world rotation of the destination marker.bool forceDestinationPosition
- If true then the given destination position should not be altered by anything consuming the payload.bool enableTeleport
- Whether the destination set event should trigger teleport.VRTK_ControllerReference controllerReference
- The optional reference to the controller controlling the destination marker.
public virtual void SetNavMeshData(VRTK_NavMeshData givenData)
VRTK_NavMeshData givenData
- The NavMeshData object that contains the NavMesh restriction settings.The SetNavMeshData method is used to limit the destination marker to the scene NavMesh based on the settings in the given NavMeshData object.
public virtual void SetHeadsetPositionCompensation(bool state)
bool state
- The state of whether to take the position of the headset within the play area into account when setting the destination marker.The SetHeadsetPositionCompensation method determines whether the offset position of the headset from the centre of the play area should be taken into consideration when setting the destination marker. If true
then it will take the offset position into consideration.
public virtual void SetForceHoverOnRepeatedEnter(bool state)
bool state
- The state of whether to force the hover on or off.The SetForceHoverOnRepeatedEnter method is used to set whether the Enter event will forciably call the Hover event if the existing colliding object is the same as it was the previous enter call.
extends VRTK_DestinationMarker
Provides a basis of being able to emit a pointer from a specified GameObject.
Required Components:
VRTK_BasePointerRenderer
- The visual representation of the pointer when activated.Optional Components:
VRTK_ControllerEvents
- The events component to listen for the button presses on. This must be applied on the same GameObject as this script if one is not provided via the Controller
parameter.VRTK_InteractUse
- The use component to utilise when the pointer is to activate the use action on an Interactable Object. This must be applied on the same GameObject as this script if one is not provided via the Interact Use
parameter.Script Usage:
VRTK_Pointer
script on either:
Transform
component to the Custom Origin
parameter of this script. This does not have to be a controller and can be any GameObject that will emit the pointer.Pointer Renderer
parameter of this script.Interact With Objects
is checked and this is checked then when an object is grabbed with the pointer touching it, the object will attach to the pointer tip and not snap to the controller.ActivationButtonPressed
- Emitted when the pointer activation button is pressed.ActivationButtonReleased
- Emitted when the pointer activation button is released.SelectionButtonPressed
- Emitted when the pointer selection button is pressed.SelectionButtonReleased
- Emitted when the pointer selection button is released.PointerStateValid
- Emitted when the pointer is in a valid state.PointerStateInvalid
- Emitted when the pointer is in an invalid state.Adding the VRTK_Pointer_UnityEvents
component to VRTK_Pointer
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.
public virtual bool IsActivationButtonPressed()
bool
- Returns true
if the activationButton is being pressed.The IsActivationButtonPressed method returns whether the configured activation button is being pressed.
public virtual bool IsSelectionButtonPressed()
bool
- Returns true
if the selectionButton is being pressed.The IsSelectionButtonPressed method returns whether the configured activation button is being pressed.
public virtual void PointerEnter(RaycastHit givenHit)
RaycastHit givenHit
- The valid collision.The PointerEnter method emits a DestinationMarkerEnter event when the pointer first enters a valid object, it emits a DestinationMarkerHover for every following frame that the pointer stays over the valid object.
public virtual void PointerExit(RaycastHit givenHit)
RaycastHit givenHit
- The previous valid collision.The PointerExit method emits a DestinationMarkerExit event when the pointer leaves a previously entered object.
public virtual bool CanActivate()
bool
- Returns true
if the pointer can be activated.The CanActivate method is used to determine if the pointer has passed the activation time limit.
public virtual bool CanSelect()
bool
- Returns true
if the pointer can execute the select action.The CanSelect method is used to determine if the pointer has passed the selection time limit.
public virtual bool IsPointerActive()
bool
- Returns true
if the pointer is currently active.The IsPointerActive method is used to determine if the pointer's current state is active or not.
public virtual void ResetActivationTimer(bool forceZero = false)
bool forceZero
- If this is true
then the next activation time will be 0.The ResetActivationTimer method is used to reset the pointer activation timer to the next valid activation time.
public virtual void ResetSelectionTimer(bool forceZero = false)
bool forceZero
- If this is true
then the next activation time will be 0.The ResetSelectionTimer method is used to reset the pointer selection timer to the next valid activation time.
public virtual void Toggle(bool state)
bool state
- If true
the pointer will be enabled if possible, if false
the pointer will be disabled if possible.The Toggle method is used to enable or disable the pointer.
public virtual bool IsStateValid()
bool
- Returns true
if the pointer is in the valid state (showing the valid colour), returns false
if the pointer is in the invalid state (showing the invalid colour).The IsStateValid method is used to determine if the pointer is currently in a valid state (i.e. on it's valid colour).
Provides a visual representation of the play area boundaries that tracks to the cursor position of a pointer.
Optional Components:
VRTK_PointerDirectionIndicator
- A Pointer Direction Indicator to set the cursor rotation to.Script Usage:
VRTK_PlayAreaCursor
script on the same GameObject as the Pointer Renderer script it is linked to.Playarea Cursor
parameter on the required Pointer Renderer script.Script Dependencies:
Pointer Miss Color
and the DestinationMarkerSet
event will not be triggered, which will prevent teleporting into areas where the play area will collide.PlayAreaCursorStartCollision
- Emitted when the play area collides with another object.PlayAreaCursorEndCollision
- Emitted when the play area stops colliding with another object.Adding the VRTK_PlayAreaCursor_UnityEvents
component to VRTK_PlayAreaCursor
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
. collidedWith
- The collider that is/was being collided with.
public virtual bool HasCollided()
bool
- Returns true
if the play area is colliding with a valid object and false
if not.The HasCollided method returns the state of whether the play area cursor has currently collided with another valid object.
public virtual void SetHeadsetPositionCompensation(bool state)
bool state
- The state of whether to take the position of the headset within the play area into account when setting the destination marker.The SetHeadsetPositionCompensation method determines whether the offset position of the headset from the centre of the play area should be taken into consideration when setting the destination marker. If true
then it will take the offset position into consideration.
public virtual void SetPlayAreaCursorCollision(bool state, Collider collider = null)
bool state
- The state of whether to check for play area collisions.Collider collider
- The state of whether to check for play area collisions.The SetPlayAreaCursorCollision method determines whether play area collisions should be taken into consideration with the play area cursor.
public virtual void SetMaterialColor(Color color, bool validity)
Color color
- The colour to update the play area cursor material to.bool validity
- Determines if the colour being set is based from a valid location or invalid location.The SetMaterialColor method sets the current material colour on the play area cursor.
public virtual void SetPlayAreaCursorTransform(Vector3 location)
Vector3 location
- The location where to draw the play area cursor.The SetPlayAreaCursorTransform method is used to update the position of the play area cursor in world space to the given location.
public virtual void ToggleState(bool state)
bool state
- The state of whether to show or hide the play area cursor.The ToggleState method enables or disables the visibility of the play area cursor.
public virtual bool IsActive()
bool
- Returns true
if the play area cursor GameObject is active.The IsActive method returns whether the play area cursor GameObject is active or not.
public virtual GameObject GetPlayAreaContainer()
GameObject
- The GameObject that is the container of the play area cursor.The GetPlayAreaContainer method returns the created GameObject that holds the play area cursor representation.
public virtual void ToggleVisibility(bool state)
bool state
- The state of the cursor visibility. True will show the renderers and false will hide the renderers.The ToggleVisibility method enables or disables the play area cursor renderers to allow the cursor to be seen or hidden.
VRTK/Examples/012_Controller_PointerWithAreaCollision
shows how a Bezier Pointer with the Play Area Cursor and Collision Detection enabled can be used to traverse a game area but not allow teleporting into areas where the walls or other objects would fall into the play area space enabling the user to enter walls.
A collection of scripts that are used to provide different renderers for the VRTK_Pointer.
Provides a base that all pointer renderers can inherit from.
Script Usage:
This is an abstract class that is to be inherited to a concrete class that provides pointer renderer functionality, therefore this script should not be directly used.
Color.clear
to bypass changing material colour on valid collision.Color.clear
to bypass changing material colour on invalid collision.public enum VisibilityStates
- States of Pointer Visibility.
OnWhenActive
- Only shows the object when the pointer is active.AlwaysOn
- Ensures the object is always.AlwaysOff
- Ensures the object beam is never visible.
public abstract GameObject[] GetPointerObjects();
GameObject[]
- An array of pointer auto generated GameObjects.The GetPointerObjects returns an array of the auto generated GameObjects associated with the pointer.
public virtual void InitalizePointer(VRTK_Pointer givenPointer, VRTK_PolicyList givenInvalidListPolicy, VRTK_NavMeshData givenNavMeshData, bool givenHeadsetPositionCompensation)
VRTK_Pointer givenPointer
- The VRTK_Pointer that is controlling the pointer renderer.VRTK_PolicyList givenInvalidListPolicy
- The VRTK_PolicyList for managing valid and invalid pointer locations.VRTK_NavMeshData givenNavMeshData
- The NavMeshData object that contains the Nav Mesh restriction options.bool givenHeadsetPositionCompensation
- Determines whether the play area cursor will take the headset position within the play area into account when being displayed.The InitalizePointer method is used to set up the state of the pointer renderer.
public virtual void ResetPointerObjects()
The ResetPointerObjects method is used to destroy any existing pointer objects and recreate them at runtime.
public virtual void Toggle(bool pointerState, bool actualState)
bool pointerState
- The activation state of the pointer.bool actualState
- The actual state of the activation button press.The Toggle Method is used to enable or disable the pointer renderer.
public virtual void ToggleInteraction(bool state)
bool state
- If true then the object interactor will be enabled.The ToggleInteraction method is used to enable or disable the controller extension interactions.
public virtual void UpdateRenderer()
The UpdateRenderer method is used to run an Update routine on the pointer.
public virtual RaycastHit GetDestinationHit()
RaycastHit
- The RaycastHit containing the information where the pointer is hitting.The GetDestinationHit method is used to get the RaycastHit of the pointer destination.
public virtual bool ValidPlayArea()
bool
- Returns true if there is a valid play area and no collisions. Returns false if there is no valid play area or there is but with a collision detected.The ValidPlayArea method is used to determine if there is a valid play area and if it has had any collisions.
public virtual bool IsVisible()
bool
- Returns true if either the tracer or cursor renderers are visible. Returns false if none are visible.The IsVisible method determines if the pointer renderer is at all visible by checking the state of the tracer and the cursor.
public virtual bool IsTracerVisible()
bool
- Returns true if the tracer renderers are visible.The IsTracerVisible method determines if the pointer tracer renderer is visible.
public virtual bool IsCursorVisible()
bool
- Returns true if the cursor renderers are visible.The IsCursorVisible method determines if the pointer cursor renderer is visible.
public virtual bool IsValidCollision()
bool
- Returns true if the pointer is in a valid collision, returns false if the pointer is in an invalid collision state.The IsValidCollision method determines if the pointer is currently in it's valid collision state.
public virtual GameObject GetObjectInteractor()
GameObject
- The auto generated object interactor GameObject.GameObject
-The GetObjectInteractor method returns the auto generated GameObject that acts as the controller extension for interacting with objects.
extends VRTK_BasePointerRenderer
A visual pointer representation of a straight beam with an optional cursor at the end.
Optional Components:
VRTK_PlayAreaCursor
- A Play Area Cursor that will track the position of the pointer cursor.VRTK_PointerDirectionIndicator
- A Pointer Direction Indicator that will track the position of the pointer cursor.Script Usage:
VRTK_StraightPointerRenderer
script on the same GameObject as the Pointer script it is linked to.Pointer Renderer
parameter on the required Pointer script.Script Dependencies:
Scale Factor
.
public override void UpdateRenderer()
The UpdateRenderer method is used to run an Update routine on the pointer.
public override GameObject[] GetPointerObjects()
GameObject[]
- An array of pointer auto generated GameObjects.The GetPointerObjects returns an array of the auto generated GameObjects associated with the pointer.
VRTK/Examples/003_Controller_SimplePointer
shows the simple pointer in action and code examples of how the events are utilised and listened to can be viewed in the script VRTK/Examples/ExampleResources/Scripts/VRTK_ControllerPointerEvents_ListenerExample.cs
extends VRTK_BasePointerRenderer
A visual pointer representation of a curved beam made from multiple objects with an optional cursor at the end.
The bezier curve generation code is in another script located at
VRTK/Source/Scripts/Internal/VRTK_CurveGenerator.cs
and was heavily inspired by the tutorial and code from Catlike Coding.
Optional Components:
VRTK_PlayAreaCursor
- A Play Area Cursor that will track the position of the pointer cursor.VRTK_PointerDirectionIndicator
- A Pointer Direction Indicator that will track the position of the pointer cursor.Script Usage:
VRTK_BezierPointerRenderer
script on the same GameObject as the Pointer script it is linked to.Pointer Renderer
parameter on the required Pointer script.Script Dependencies:
Pointer Density
. The higher the number, the more CPU intensive the checks become.
public override void UpdateRenderer()
The UpdateRenderer method is used to run an Update routine on the pointer.
public override GameObject[] GetPointerObjects()
GameObject[]
- An array of pointer auto generated GameObjects.The GetPointerObjects returns an array of the auto generated GameObjects associated with the pointer.
VRTK/Examples/009_Controller_BezierPointer
is used in conjunction with the Height Adjust Teleporter shows how it is possible to traverse different height objects using the curved pointer without needing to see the top of the object.
`VRTK/Examples/036_Controller_CustomCompoundPointer' shows how to display an object (a teleport beam) only if the teleport location is valid, and can create an animated trail along the tracer curve.
A collection of scripts that provide varying methods of moving the user around the scene.
Updates the x/z
position of the SDK Camera Rig with an optional screen fade.
The
y
position is not altered by the Basic Teleport so it only allows for movement across a 2D plane.
Script Usage:
VRTK_BasicTeleport
script on any active scene GameObject.Script Dependencies:
Blink To Color
. Setting the speed to 0
will mean no fade effect is present.0
will not delay the teleport fade effect over any distance, a max value will delay the teleport fade in even when the distance teleported is very close to the original position.Teleporting
- Emitted when the teleport process has begun.Teleported
- Emitted when the teleport process has successfully completed.Adding the VRTK_BasicTeleport_UnityEvents
component to VRTK_BasicTeleport
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.float distance
- The distance between the origin and the collided destination.Transform target
- The Transform of the collided destination object.RaycastHit raycastHit
- The optional RaycastHit generated from when the ray collided.Vector3 destinationPosition
- The world position of the destination marker.Quaternion? destinationRotation
- The world rotation of the destination marker.bool forceDestinationPosition
- If true then the given destination position should not be altered by anything consuming the payload.bool enableTeleport
- Whether the destination set event should trigger teleport.VRTK_ControllerReference controllerReference
- The optional reference to the controller controlling the destination marker.
public virtual void InitDestinationSetListener(GameObject markerMaker, bool register)
GameObject markerMaker
- The game object that is used to generate destination marker events, such as a controller.bool register
- Determines whether to register or unregister the listeners.The InitDestinationSetListener method is used to register the teleport script to listen to events from the given game object that is used to generate destination markers. Any destination set event emitted by a registered game object will initiate the teleport to the given destination location.
public virtual void ToggleTeleportEnabled(bool state)
bool state
- Toggles whether the teleporter is enabled or disabled.The ToggleTeleportEnabled method is used to determine whether the teleporter will initiate a teleport on a destination set event, if the state is true then the teleporter will work as normal, if the state is false then the teleporter will not be operational.
public virtual bool ValidLocation(Transform target, Vector3 destinationPosition)
Transform target
- The Transform that the destination marker is touching.Vector3 destinationPosition
- The position in world space that is the destination.bool
- Returns true
if the target is a valid location.The ValidLocation method determines if the given target is a location that can be teleported to
public virtual void Teleport(DestinationMarkerEventArgs teleportArgs)
DestinationMarkerEventArgs teleportArgs
- The pseudo Destination Marker event for the teleport action.The Teleport/1 method calls the teleport to update position without needing to listen for a Destination Marker event.
public virtual void Teleport(Transform target, Vector3 destinationPosition, Quaternion? destinationRotation = null, bool forceDestinationPosition = false)
Transform target
- The Transform of the destination object.Vector3 destinationPosition
- The world position to teleport to.Quaternion? destinationRotation
- The world rotation to teleport to.bool forceDestinationPosition
- If true
then the given destination position should not be altered by anything consuming the payload.The Teleport/4 method calls the teleport to update position without needing to listen for a Destination Marker event. It will build a destination marker out of the provided parameters.
public virtual void ForceTeleport(Vector3 destinationPosition, Quaternion? destinationRotation = null)
Vector3 destinationPosition
- The world position to teleport to.Quaternion? destinationRotation
- The world rotation to teleport to.The ForceTeleport method forces the position to update to a given destination and ignores any target checking or floor adjustment.
public virtual void SetActualTeleportDestination(Vector3 actualPosition, Quaternion? actualRotation)
Vector3 actualPosition
- The actual position that the teleport event should use as the final location.Quaternion? actualRotation
- The actual rotation that the teleport event should use as the final location.The SetActualTeleportDestination method forces the destination of a teleport event to the given Vector3.
public virtual void ResetActualTeleportDestination()
The ResetActualTeleportDestination method removes any previous forced destination position that was set by the SetActualTeleportDestination method.
VRTK/Examples/004_CameraRig_BasicTeleport
uses the VRTK_Pointer
script on the Controllers to initiate a laser pointer by pressing the Touchpad
on the controller and when the laser pointer is deactivated (release the Touchpad
) then the user is teleported to the location of the laser pointer tip as this is where the pointer destination marker position is set to.
extends VRTK_BasicTeleport
Updates the x/y/z
position of the SDK Camera Rig with an optional screen fade.
The Camera Rig can be automatically teleported to the nearest floor
y
position when utilising this teleporter.
Script Usage:
VRTK_HeightAdjustTeleport
script on any active scene GameObject.Script Dependencies:
VRTK/Examples/007_CameraRig_HeightAdjustTeleport
has a collection of varying height objects that the user can either walk up and down or use the laser pointer to climb on top of them.
VRTK/Examples/010_CameraRig_TerrainTeleporting
shows how the teleportation of a user can also traverse terrain colliders.
VRTK/Examples/020_CameraRig_MeshTeleporting
shows how the teleportation of a user can also traverse mesh colliders.
extends VRTK_HeightAdjustTeleport
Updates the x/y/z
position of the SDK Camera Rig with a lerp to the new position creating a dash effect.
Script Usage:
VRTK_DashTeleport
script on any active scene GameObject.Script Dependencies:
WillDashThruObjects
- Emitted when the CapsuleCast towards the target has found that obstacles are in the way.DashedThruObjects
- Emitted when obstacles have been crossed and the dash has ended.Adding the VRTK_DashTeleport_UnityEvents
component to VRTK_DashTeleport
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.RaycastHit[] hits
- An array of RaycastHits that the CapsuleCast has collided with.VRTK/Examples/038_CameraRig_DashTeleport
shows how to turn off the mesh renderers of objects that are in the way during the dash.
Prevents teleportation when the HMD is colliding with valid geometry.
Required Components:
VRTK_BasicTeleport
- A Teleport script to utilise for teleporting the play area.VRTK_HeadsetCollision
- A Headset Collision script for detecting when the headset has collided with valid geometry.Script Usage:
VRTK_TeleportDisableOnHeadsetCollision
script on any active scene GameObject.Prevents teleportation when the controllers are obscured from line of sight of the HMD.
Required Components:
VRTK_BasicTeleport
- A Teleport script to utilise for teleporting the play area.VRTK_HeadsetControllerAware
- A Headset Controller Aware script to determine when the HMD has line of sight to the controllers.Script Usage:
VRTK_TeleportDisableOnControllerObscured
script on any active scene GameObject.Provides a base that all object control locomotions can inherit from.
Script Usage:
This is an abstract class that is to be inherited to a concrete class that provides object control locomotion functionality, therefore this script should not be directly used.
VRTK_BodyPhysics
script is present and this is checked, then the object control will affect the play area whilst it is falling.public enum DirectionDevices
- Devices for providing direction.
Headset
- The headset device.LeftController
- The left controller device.RightController
- The right controller device.ControlledObject
- The controlled object.XAxisChanged
- Emitted when the X Axis Changes.YAxisChanged
- Emitted when the Y Axis Changes.Adding the VRTK_ObjectControl_UnityEvents
component to VRTK_ObjectControl
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.GameObject controlledGameObject
- The GameObject that is going to be affected.Transform directionDevice
- The device that is used for the direction.Vector3 axisDirection
- The axis that is being affected.Vector3 axis
- The value of the current touchpad touch point based across the axis direction.float deadzone
- The value of the deadzone based across the axis direction.bool currentlyFalling
- Whether the controlled GameObject is currently falling.bool modifierActive
- Whether the modifier button is pressed.extends VRTK_ObjectControl
Provides the ability to control a GameObject's position based on the position of the controller touchpad axis.
This script forms the stub of emitting the touchpad axis X and Y changes that are then digested by the corresponding Object Control Actions that are listening for the relevant event.
Required Components:
VRTK_ControllerEvents
- The Controller Events script to listen for the touchpad events on.Optional Components:
VRTK_BodyPhysics
- The Body Physics script to utilise to determine if falling is occuring.Script Usage:
VRTK_TouchpadControl
script on either:
VRTK_ControllerEvents
component to the Controller
parameter of this script.0f
and 1f
.VRTK/Examples/017_CameraRig_TouchpadWalking
has a collection of walls and slopes that can be traversed by the user with the touchpad. There is also an area that can only be traversed if the user is crouching.
extends VRTK_ObjectControl
Provides the ability to control a GameObject's position based the press of a controller button linked to a specific axis direction.
This script forms the stub of emitting the axis X and Y changes that are then digested by the corresponding Object Control Actions that are listening for the relevant event.
Required Components:
VRTK_ControllerEvents
- The Controller Events script to listen for button presses events on.Optional Components:
VRTK_BodyPhysics
- The Body Physics script to utilise to determine if falling is occuring.Script Usage:
VRTK_ButtonControl
script on either:
VRTK_ControllerEvents
component to the Controller
parameter of this script.Moves the SDK Camera Rig based on the motion of the headset and/or the controllers. Attempts to recreate the concept of physically walking on the spot to create scene movement.
This locomotion method is based on Immersive Movement, originally created by Highsight. Thanks to KJack (author of Arm Swinger) for additional work.
Optional Components:
VRTK_BodyPhysics
- A Body Physics script to help determine potential collisions in the moving direction and prevent collision tunnelling.Script Usage:
VRTK_MoveInPlace
script on any active scene GameObject.Script Dependencies:
public enum ControlOptions
- Valid control options
HeadsetAndControllers
- Track both headset and controllers for movement calculations.ControllersOnly
- Track only the controllers for movement calculations.HeadsetOnly
- Track only headset for movement caluclations.public enum DirectionalMethod
- Options for which method is used to determine direction while moving.
Gaze
- Will always move in the direction they are currently looking.ControllerRotation
- Will move in the direction that the controllers are pointing (averaged).DumbDecoupling
- Will move in the direction they were first looking when they engaged Move In Place.SmartDecoupling
- Will move in the direction they are looking only if their headset point the same direction as their controllers.EngageControllerRotationOnly
- Will move in the direction that the controller with the engage button pressed is pointing.LeftControllerRotationOnly
- Will move in the direction that the left controller is pointing.RightControllerRotationOnly
- Will move in the direction that the right controller is pointing.
public virtual void SetControlOptions(ControlOptions givenControlOptions)
ControlOptions givenControlOptions
- The control options to set the current control options to.Set the control options and modify the trackables to match.
public virtual Vector3 GetMovementDirection()
Vector3
- Returns a Vector3 representing the current movement direction.The GetMovementDirection method will return the direction the play area is currently moving in.
public virtual float GetSpeed()
float
- Returns a float representing the current movement speed.The GetSpeed method will return the current speed the play area is moving at.
VRTK/Examples/042_CameraRig_MoveInPlace
demonstrates how the user can move and traverse colliders by either swinging the controllers in a walking fashion or by running on the spot utilisng the head bob for movement.
Provides the ability for the SDK Camera Rig to be moved around based on whether an Interact Grab is interacting with a Climbable Interactable Object to simulate climbing.
Required Components:
VRTK_BodyPhysics
- A Body Physics script to deal with the effects of physics and gravity on the play area.Optional Components:
VRTK_BasicTeleport
- A Teleporter script to use when snapping the play area to the nearest floor when releasing from grab.VRTK_HeadsetCollision
- A Headset Collision script to determine when the headset is colliding with geometry to know when to reset to a valid location.VRTK_PositionRewind
- A Position Rewind script to utilise when resetting to a valid location upon ungrabbing whilst colliding with geometry.Script Usage:
VRTK_PlayerClimb
script on any active scene GameObject.Script Dependencies:
PlayerClimbStarted
- Emitted when player climbing has started.PlayerClimbEnded
- Emitted when player climbing has ended.Adding the VRTK_PlayerClimb_UnityEvents
component to VRTK_PlayerClimb
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.VRTK_ControllerReference controllerReference
- The reference to the controller doing the interaction.GameObject target
- The GameObject of the interactable object that is being interacted with by the controller.
public virtual bool IsClimbing()
bool
- Returns true
if climbing is currently taking place.The IsClimbing method will return if climbing is currently taking place or not.
VRTK/Examples/037_CameraRig_ClimbingFalling
shows how to set up a scene with player climbing. There are many different examples showing how the same system can be used in unique ways.
Provides the ability for the SDK Camera Rig to be thrown around with a jumping motion by slingshotting based on the pull back of each valid controller.
Required Components:
VRTK_PlayerClimb
- A Player Climb script for dealing with the physical throwing of the play area as if throwing off an invisible climbed object.VRTK_BodyPhysics
- A Body Physics script to deal with the effects of physics and gravity on the play area.Optional Components:
VRTK_BasicTeleport
- A Teleporter script to use when snapping the play area to the nearest floor when releasing from grab.VRTK_HeadsetCollision
- A Headset Collision script to determine when the headset is colliding with geometry to know when to reset to a valid location.VRTK_PositionRewind
- A Position Rewind script to utilise when resetting to a valid location upon ungrabbing whilst colliding with geometry.Script Usage:
VRTK_SlingshotJump
script on the same GameObject as the VRTK_PlayerClimb
script.SlingshotJumped
- Emitted when a slingshot jump occursAdding the VRTK_SlingshotJump_UnityEvents
component to VRTK_SlingshotJump
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.
public virtual VRTK_ControllerEvents.ButtonAlias GetActivationButton()
VRTK_ControllerEvents.ButtonAlias
- Returns the button used for slingshot activation.The SetActivationButton method gets the button used to activate a slingshot jump.
public virtual void SetActivationButton(VRTK_ControllerEvents.ButtonAlias button)
VRTK_ControllerEvents.ButtonAlias button
- The controller button to use to activate the jump.The SetActivationButton method sets the button used to activate a slingshot jump.
public virtual VRTK_ControllerEvents.ButtonAlias GetCancelButton()
VRTK_ControllerEvents.ButtonAlias
- Returns the button used to cancel a slingshot jump.The GetCancelButton method gets the button used to cancel a slingshot jump.
public virtual void SetCancelButton(VRTK_ControllerEvents.ButtonAlias button)
VRTK_ControllerEvents.ButtonAlias button
- The controller button to use to cancel the jump.The SetCancelButton method sets the button used to cancel a slingshot jump.
VRTK/Examples/037_CameraRig_ClimbingFalling
shows how to set up a scene with slingshot jumping. This script just needs to be added to the PlayArea object and the requested forces and buttons set.
Multiplies each real world step within the play area to enable further distances to be travelled in the virtual world.
Optional Components:
VRTK_ControllerEvents
- The events component to listen for the button presses on. This must be applied on the same GameObject as this script if one is not provided via the Controller Events
parameter.Script Usage:
VRTK_StepMultiplier
script on either:
VRTK_ControllerEvents
component to the Controller Events
parameter of this script if an activation button is required.Undefined
then the step multiplier will always be active.0
is no movement of the play area. Higher values simulate a bigger play area but may be too uncomfortable.public enum MovementFunction
- Movement methods.
Nonlinear
- Moves the head with a non-linear drift movement.LinearDirect
- Moves the headset in a direct linear movement.VRTK/Examples/028_CameraRig_RoomExtender
shows how the Step Multiplier can be used to move around the scene with multiplied steps.
Applys a tunnel overlay effect to the active VR camera when the play area is moving or rotating to reduce potential nausea caused by simulation sickness.
Script Usage:
VRTK_TunnelOverlay
script on any active scene GameObject.This implementation is based on a project made by SixWays at https://github.com/SixWays/UnityVrTunnelling
Provides the ability to move, rotate and scale the PlayArea by dragging the world with the controllers.
Script Usage:
VRTK_DragWorld
script on any active scene GameObject.If only one controller is being used to track the rotation mechanism, then the rotation will be based on the perpendicual (yaw) axis angular velocity of the tracking controller. If both controllers are being used to track the rotation mechanism, then the rotation will be based on pushing one controller forward, whilst pulling the other controller backwards.
BothControllers
requires both controllers to be pushed/pulled to rotate, whereas any other setting will base rotation on the rotation of the activating controller.Offset Transform
when dealing with rotational offsets.public enum ActivationRequirement
- The controller on which to determine as the activation requirement for the control mechanism.
LeftControllerOnly
- Only pressing the activation button on the left controller will activate the mechanism, if the right button is held down then the mechanism will not be activated.RightControllerOnly
- Only pressing the activation button on the right controller will activate the mechanism, if the left button is held down then the mechanism will not be activated.LeftController
- Pressing the activation button on the left controller is all that is required to activate the mechanism.RightController
- Pressing the activation button on the right controller is all that is required to activate the mechanism.EitherController
- Pressing the activation button on the either controller is all that is required to activate the mechanism.BothControllers
- Pressing the activation button on both controllers is required to activate the mechanism.public enum TrackingController
- The controllers which to track when performing the mechanism.
LeftController
- Only track the left controller.RightController
- Only track the right controller.EitherController
- Track either the left or the right controller.BothControllers
- Only track both controllers at the same time.A collection of scripts that are used to provide different actions when using Object Control.
Provides a base that all object control actions can inherit from.
Script Usage:
This is an abstract class that is to be inherited to a concrete class that provides object control action functionality, therefore this script should not be directly used.
public enum AxisListeners
- The axis to listen to changes on.
XAxisChanged
- Listen for changes on the horizontal X axis.YAxisChanged
- Listen for changes on the vertical y axis.extends VRTK_BaseObjectControlAction
Provides the ability to move a GameObject around by sliding it across the x/z
plane in the scene by updating the Transform position when the corresponding Object Control axis changes.
The effect is a smooth sliding motion in forward and sideways directions to simulate walking.
Required Components:
VRTK_ObjectControl
- The Object Control script to listen for the axis changes on.Optional Components:
VRTK_BodyPhysics
- The Body Physics script to utilise when checking for potential collisions on movement.Script Usage:
VRTK_SlideObjectControlAction
script on any active scene GameObject.Object Control Script
parameter of this script.Listen On Axis Change
parameter on this script to the axis change to affect with this movement type.VRTK/Examples/017_CameraRig_TouchpadWalking
has a collection of walls and slopes that can be traversed by the user with the touchpad. There is also an area that can only be traversed if the user is crouching.
To enable the Slide Object Control Action, ensure one of the TouchpadControlOptions
children (located under the Controller script alias) has the Slide
control script active.
extends VRTK_BaseObjectControlAction
Provides the ability to rotate a GameObject through the world y
axis in the scene by updating the Transform rotation when the corresponding Object Control axis changes.
The effect is a smooth rotation to simulate turning.
Required Components:
VRTK_ObjectControl
- The Object Control script to listen for the axis changes on.Script Usage:
VRTK_RotateObjectControlAction
script on any active scene GameObject.Object Control Script
parameter of this script.Listen On Axis Change
parameter on this script to the axis change to affect with this movement type.VRTK/Examples/017_CameraRig_TouchpadWalking
has a collection of walls and slopes that can be traversed by the user with the touchpad. There is also an area that can only be traversed if the user is crouching.
To enable the Rotate Object Control Action, ensure one of the TouchpadControlOptions
children (located under the Controller script alias) has the Rotate
control script active.
extends VRTK_BaseObjectControlAction
Provides the ability to snap rotate a GameObject through the world y
axis in the scene by updating the Transform rotation in defined steps when the corresponding Object Control axis changes.
The effect is a immediate snap rotation to quickly face in a new direction.
Required Components:
VRTK_ObjectControl
- The Object Control script to listen for the axis changes on.Script Usage:
VRTK_SnapRotateObjectControlAction
script on any active scene GameObject.Object Control Script
parameter of this script.Listen On Axis Change
parameter on this script to the axis change to affect with this movement type.VRTK/Examples/017_CameraRig_TouchpadWalking
has a collection of walls and slopes that can be traversed by the user with the touchpad. There is also an area that can only be traversed if the user is crouching.
To enable the Snap Rotate Object Control Action, ensure one of the TouchpadControlOptions
children (located under the Controller script alias) has the Snap Rotate
control script active.
extends VRTK_BaseObjectControlAction
Provides the ability to move a GameObject around by warping it across the x/z
plane in the scene by updating the Transform position in defined steps when the corresponding Object Control axis changes.
The effect is a immediate snap to a new position in the given direction.
Required Components:
VRTK_ObjectControl
- The Object Control script to listen for the axis changes on.Optional Components:
VRTK_BodyPhysics
- The Body Physics script to utilise when checking for potential collisions on movement.Script Usage:
VRTK_WarpObjectControlAction
script on any active scene GameObject.Object Control Script
parameter of this script.Listen On Axis Change
parameter on this script to the axis change to affect with this movement type.VRTK/Examples/017_CameraRig_TouchpadWalking
has a collection of walls and slopes that can be traversed by the user with the touchpad. There is also an area that can only be traversed if the user is crouching.
To enable the Warp Object Control Action, ensure one of the TouchpadControlOptions
children (located under the Controller script alias) has the Warp
control script active.
A collection of scripts that are used to provide highlighting.
Provides a base that all highlighters can inherit from.
Script Usage:
This is an abstract class that is to be inherited to a concrete class that provides highlight functionality, therefore this script should not be directly used.
public abstract void Initialise(Color? color = null, GameObject affectObject = null, Dictionary<string, object> options = null);
Color? color
- An optional colour may be passed through at point of initialisation in case the highlighter requires it.GameObject affectObject
- An optional GameObject to specify which object to apply the highlighting to.Dictionary<string, object> options
- An optional dictionary of highlighter specific options that may be differ with highlighter implementations.The Initalise method is used to set up the state of the highlighter.
public abstract void ResetHighlighter();
The ResetHighlighter method is used to reset the highlighter if anything on the object has changed. It should be called by any scripts changing object materials or colours.
public abstract void Highlight(Color? color = null, float duration = 0f);
Color? color
- An optional colour to highlight the game object to. The highlight colour may already have been set in the Initialise
method so may not be required here.float duration
- An optional duration of how long before the highlight has occured. It can be used by highlighters to fade the colour if possible.The Highlight method is used to initiate the highlighting logic to apply to an object.
public abstract void Unhighlight(Color? color = null, float duration = 0f);
Color? color
- An optional colour that could be used during the unhighlight phase. Usually will be left as null.float duration
- An optional duration of how long before the unhighlight has occured.The Unhighlight method is used to initiate the logic that returns an object back to it's original appearance.
public virtual T GetOption<T>(Dictionary<string, object> options, string key)
T
- The system type that is expected to be returned.Dictionary<string, object> options
- The dictionary of options to check in.string key
- The identifier key to look for.T
- The value in the options at the given key returned in the provided system type.The GetOption method is used to return a value from the options array if the given key exists.
public virtual bool UsesClonedObject()
bool
- Returns true
if the highlighter creates a cloned object to apply the highlighter on, returns false
if no additional object is created.The UsesClonedObject method is used to return whether the current highlighter creates a cloned object to do the highlighting with.
public static VRTK_BaseHighlighter GetActiveHighlighter(GameObject obj)
GameObject obj
- The GameObject to check for a highlighter on.VRTK_BaseHighlighter
- A valid and active highlighter.The GetActiveHighlighter method checks the given GameObject for a valid and active highlighter.
extends VRTK_BaseHighlighter
Swaps the texture colour on the Renderers material for the given highlight colour.
Due to the way the object material is interacted with, changing the material colour will break Draw Call Batching in Unity whilst the object is highlighted. The Draw Call Batching will resume on the original material when the item is no longer highlighted.
Script Usage:
VRTK_MaterialColorSwapHighlighter
script on either:
Object Highlighter
parameter to denote use of the highlighter.Active
parameter is checked.
public override void Initialise(Color? color = null, GameObject affectObject = null, Dictionary<string, object> options = null)
Color? color
- Not used.GameObject affectObject
- An optional GameObject to specify which object to apply the highlighting to.Dictionary<string, object> options
- A dictionary array containing the highlighter options:
<'resetMainTexture', bool>
- Determines if the default main texture should be cleared on highlight. true
to reset the main default texture, false
to not reset it.The Initialise method sets up the highlighter for use.
public override void ResetHighlighter()
The ResetHighlighter method stores the object's materials and shared materials prior to highlighting.
public override void Highlight(Color? color, float duration = 0f)
Color? color
- The colour to highlight to.float duration
- The time taken to fade to the highlighted colour.The Highlight method initiates the change of colour on the object and will fade to that colour (from a base white colour) for the given duration.
public override void Unhighlight(Color? color = null, float duration = 0f)
Color? color
- Not used.float duration
- Not used.The Unhighlight method returns the object back to it's original colour.
VRTK/Examples/005_Controller_BasicObjectGrabbing
demonstrates the solid highlighting on the green cube, red cube and flying saucer when the controller touches it.
VRTK/Examples/035_Controller_OpacityAndHighlighting
demonstrates the solid highlighting if the right controller collides with the green box or if any of the buttons are pressed.
Swaps the texture colour on the Renderers material for the given highlight colour using property blocks.
Utilising the MaterialPropertyBlock means that Draw Call Batching in Unity is not compromised.
Script Usage:
VRTK_MaterialPropertyBlockColorSwapHighlighter
script on either:
Object Highlighter
parameter to denote use of the highlighter.Active
parameter is checked.
public override void Initialise(Color? color = null, GameObject affectObject = null, Dictionary<string, object> options = null)
Color? color
- Not used.GameObject affectObject
- An optional GameObject to specify which object to apply the highlighting to.Dictionary<string, object> options
- A dictionary array containing the highlighter options:
<'resetMainTexture', bool>
- Determines if the default main texture should be cleared on highlight. true
to reset the main default texture, false
to not reset it.The Initialise method sets up the highlighter for use.
public override void Unhighlight(Color? color = null, float duration = 0f)
Color? color
- Not used.float duration
- Not used.The Unhighlight method returns the object back to it's original colour.
extends VRTK_BaseHighlighter
Creates a mesh copy and applies an outline shader which is toggled on and off when highlighting the object.
A valid mesh must be found or provided for the clone mesh to be created.
Script Usage:
VRTK_OutlineObjectCopyHighlighter
script on either:
Object Highlighter
parameter to denote use of the highlighter.Active
parameter is checked.
public override void Initialise(Color? color = null, GameObject affectObject = null, Dictionary<string, object> options = null)
Color? color
- Not used.GameObject affectObject
- An optional GameObject to specify which object to apply the highlighting to.Dictionary<string, object> options
- A dictionary array containing the highlighter options:
<'thickness', float>
- Same as thickness
inspector parameter.<'customOutlineModels', GameObject[]>
- Same as customOutlineModels
inspector parameter.<'customOutlineModelPaths', string[]>
- Same as customOutlineModelPaths
inspector parameter.The Initialise method sets up the highlighter for use.
public override void ResetHighlighter()
The ResetHighlighter method creates the additional model to use as the outline highlighted object.
public override void Highlight(Color? color, float duration = 0f)
Color? color
- The colour to outline with.float duration
- Not used.The Highlight method initiates the outline object to be enabled and display the outline colour.
public override void Unhighlight(Color? color = null, float duration = 0f)
Color? color
- Not used.float duration
- Not used.The Unhighlight method hides the outline object and removes the outline colour.
VRTK/Examples/005_Controller_BasicObjectGrabbing
demonstrates the outline highlighting on the green sphere when the controller touches it.
VRTK/Examples/035_Controller_OpacityAndHighlighting
demonstrates the outline highlighting if the left controller collides with the green box.
A collection of scripts that provide the ability denote objects (such as controllers) as being able to interact with interactable objects.
A relationship to a physical VR controller and emits events based on the inputs of the controller.
Script Usage:
VRTK_ControllerEvents
script on the controller script alias GameObject of the controller to track (e.g. Right Controller Script Alias).public enum ButtonAlias
- Button types
Undefined
- No button specified.TriggerHairline
- The trigger is squeezed past the current hairline threshold.TriggerTouch
- The trigger is squeezed a small amount.TriggerPress
- The trigger is squeezed about half way in.TriggerClick
- The trigger is squeezed all the way down.GripHairline
- The grip is squeezed past the current hairline threshold.GripTouch
- The grip button is touched.GripPress
- The grip button is pressed.GripClick
- The grip button is pressed all the way down.TouchpadTouch
- The touchpad is touched (without pressing down to click).TouchpadPress
- The touchpad is pressed (to the point of hearing a click).TouchpadTwoTouch
- The touchpad two is touched (without pressing down to click).TouchpadTwoPress
- The touchpad two is pressed (to the point of hearing a click).ButtonOneTouch
- The button one is touched.ButtonOnePress
- The button one is pressed.ButtonTwoTouch
- The button two is touched.ButtonTwoPress
- The button two is pressed.StartMenuPress
- The start menu is pressed.TouchpadSense
- The touchpad sense touch is active.TriggerSense
- The trigger sense touch is active.MiddleFingerSense
- The middle finger sense touch is active.RingFingerSense
- The ring finger sense touch is active.PinkyFingerSense
- The pinky finger sense touch is active.GripSense
- The grip sense axis touch is active.GripSensePress
- The grip sense axis is pressed.public enum Vector2AxisAlias
- Vector2 Axis Types.
Undefined
- No axis specified.Touchpad
- Touchpad on the controller.TouchpadTwo
- Touchpad Two on the controller.public enum AxisType
- Axis Types
Digital
- A digital axis with a binary result of 0f not pressed or 1f is pressed.Axis
- An analog axis ranging from no squeeze at 0f to full squeeze at 1f.SenseAxis
- A cap sens axis ranging from not near at 0f to touching at 1f.public bool triggerPressed
- This will be true if the trigger is squeezed about half way in. Default: false
public bool triggerTouched
- This will be true if the trigger is squeezed a small amount. Default: false
public bool triggerHairlinePressed
- This will be true if the trigger is squeezed a small amount more from any previous squeeze on the trigger. Default: false
public bool triggerClicked
- This will be true if the trigger is squeezed all the way down. Default: false
public bool triggerAxisChanged
- This will be true if the trigger has been squeezed more or less. Default: false
public bool triggerSenseAxisChanged
- This will be true if the trigger sense is being touched more or less. Default: false
public bool gripPressed
- This will be true if the grip is squeezed about half way in. Default: false
public bool gripTouched
- This will be true if the grip is touched. Default: false
public bool gripHairlinePressed
- This will be true if the grip is squeezed a small amount more from any previous squeeze on the grip. Default: false
public bool gripClicked
- This will be true if the grip is squeezed all the way down. Default: false
public bool gripAxisChanged
- This will be true if the grip has been squeezed more or less. Default: false
public bool touchpadPressed
- This will be true if the touchpad is held down. Default: false
public bool touchpadTouched
- This will be true if the touchpad is being touched. Default: false
public bool touchpadAxisChanged
- This will be true if the touchpad position has changed. Default: false
public bool touchpadSenseAxisChanged
- This will be true if the touchpad sense is being touched more or less. Default: false
public bool touchpadTwoTouched
- This will be true if the touchpad two is being touched. Default: false
public bool touchpadTwoPressed
- This will be true if the touchpad two is held down. Default: false
public bool touchpadTwoAxisChanged
- This will be true if the touchpad two position has changed. Default: false
public bool buttonOnePressed
- This will be true if button one is held down. Default: false
public bool buttonOneTouched
- This will be true if button one is being touched. Default: false
public bool buttonTwoPressed
- This will be true if button two is held down. Default: false
public bool buttonTwoTouched
- This will be true if button two is being touched. Default: false
public bool startMenuPressed
- This will be true if start menu is held down. Default: false
public bool middleFingerSenseAxisChanged
- This will be true if the middle finger sense is being touched more or less. Default: false
public bool ringFingerSenseAxisChanged
- This will be true if the ring finger sense is being touched more or less. Default: false
public bool pinkyFingerSenseAxisChanged
- This will be true if the pinky finger sense is being touched more or less. Default: false
public bool gripSenseAxisChanged
- This will be true if the grip sense is being touched more or less. Default: false
public bool gripSensePressed
- This will be true if grip sense is held down. Default: false
public bool controllerVisible
- This will be true if the controller model alias renderers are visible. Default: true
TriggerPressed
- Emitted when the trigger is squeezed about half way in.TriggerReleased
- Emitted when the trigger is released under half way.TriggerTouchStart
- Emitted when the trigger is squeezed a small amount.TriggerTouchEnd
- Emitted when the trigger is no longer being squeezed at all.TriggerHairlineStart
- Emitted when the trigger is squeezed past the current hairline threshold.TriggerHairlineEnd
- Emitted when the trigger is released past the current hairline threshold.TriggerClicked
- Emitted when the trigger is squeezed all the way down.TriggerUnclicked
- Emitted when the trigger is no longer being held all the way down.TriggerAxisChanged
- Emitted when the amount of squeeze on the trigger changes.TriggerSenseAxisChanged
- Emitted when the amount of touch on the trigger sense changes.GripPressed
- Emitted when the grip is squeezed about half way in.GripReleased
- Emitted when the grip is released under half way.GripTouchStart
- Emitted when the grip is squeezed a small amount.GripTouchEnd
- Emitted when the grip is no longer being squeezed at all.GripHairlineStart
- Emitted when the grip is squeezed past the current hairline threshold.GripHairlineEnd
- Emitted when the grip is released past the current hairline threshold.GripClicked
- Emitted when the grip is squeezed all the way down.GripUnclicked
- Emitted when the grip is no longer being held all the way down.GripAxisChanged
- Emitted when the amount of squeeze on the grip changes.TouchpadPressed
- Emitted when the touchpad is pressed (to the point of hearing a click).TouchpadReleased
- Emitted when the touchpad has been released after a pressed state.TouchpadTouchStart
- Emitted when the touchpad is touched (without pressing down to click).TouchpadTouchEnd
- Emitted when the touchpad is no longer being touched.TouchpadAxisChanged
- Emitted when the touchpad is being touched in a different location.TouchpadSenseAxisChanged
- Emitted when the amount of touch on the touchpad sense changes.TouchpadTwoPressed
- Emitted when the touchpad two is pressed (to the point of hearing a click).TouchpadTwoReleased
- Emitted when the touchpad two has been released after a pressed state.TouchpadTwoTouchStart
- Emitted when the touchpad two is touched (without pressing down to click).TouchpadTwoTouchEnd
- Emitted when the touchpad two is no longer being touched.TouchpadTwoAxisChanged
- Emitted when the touchpad two is being touched in a different location.ButtonOneTouchStart
- Emitted when button one is touched.ButtonOneTouchEnd
- Emitted when button one is no longer being touched.ButtonOnePressed
- Emitted when button one is pressed.ButtonOneReleased
- Emitted when button one is released.ButtonTwoTouchStart
- Emitted when button two is touched.ButtonTwoTouchEnd
- Emitted when button two is no longer being touched.ButtonTwoPressed
- Emitted when button two is pressed.ButtonTwoReleased
- Emitted when button two is released.StartMenuPressed
- Emitted when start menu is pressed.StartMenuReleased
- Emitted when start menu is released.MiddleFingerSenseAxisChanged
- Emitted when the amount of touch on the middle finger sense changes.RingFingerSenseAxisChanged
- Emitted when the amount of touch on the ring finger sense changes.PinkyFingerSenseAxisChanged
- Emitted when the amount of touch on the pinky finger sense changes.GripSenseAxisChanged
- Emitted when the amount of touch on the grip sense changes.GripSensePressed
- Emitted when grip sense is pressed.GripSenseReleased
- Emitted when grip sense is released.ControllerEnabled
- Emitted when the controller is enabled.ControllerDisabled
- Emitted when the controller is disabled.ControllerIndexChanged
- Emitted when the controller index changed.ControllerModelAvailable
- Emitted when the controller model becomes available.ControllerVisible
- Emitted when the controller is set to visible.ControllerHidden
- Emitted when the controller is set to hidden.Adding the VRTK_ControllerEvents_UnityEvents
component to VRTK_ControllerEvents
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.VRTK_ControllerReference controllerReference
- The reference for the controller that initiated the event.float buttonPressure
- The amount of pressure being applied to the button pressed. 0f
to 1f
.Vector2 touchpadAxis
- The position the touchpad is touched at. (0,0)
to (1,1)
.float touchpadAngle
- The rotational position the touchpad is being touched at, 0 being top, 180 being bottom and all other angles accordingly. 0f
to 360f
.Vector2 touchpadTwoAxis
- The position the touchpad two is touched at. (0,0)
to (1,1)
.float touchpadTwoAngle
- The rotational position the touchpad two is being touched at, 0 being top, 180 being bottom and all other angles accordingly. 0f
to 360f
.
public virtual ControllerInteractionEventArgs SetControllerEvent()
ControllerInteractionEventArgs
- The payload for a Controller Event.The SetControllerEvent/0 method is used to set the Controller Event payload.
public virtual ControllerInteractionEventArgs SetControllerEvent(ref bool buttonBool, bool value = false, float buttonPressure = 0f)
ref bool buttonBool
- The state of the pressed button if required.bool value
- The value to set the buttonBool
reference to.float buttonPressure
- The pressure of the button pressed if required.ControllerInteractionEventArgs
- The payload for a Controller Event.The SetControllerEvent/3 method is used to set the Controller Event payload.
public virtual SDK_BaseController.ControllerType GetControllerType()
SDK_BaseController.ControllerType
- The type of controller that the Controller Events is attached to.The GetControllerType method is a shortcut to retrieve the current controller type the Controller Events is attached to.
public virtual Vector2 GetAxis(Vector2AxisAlias vector2AxisType)
Vector2AxisAlias vector2AxisType
- The Vector2AxisType to check the touch position of.Vector2
- A two dimensional vector containing the x
and y
position of where the given axis type is being touched. (0,0)
to (1,1)
.The GetAxis method returns the coordinates of where the given axis type is being touched.
public virtual Vector2 GetTouchpadAxis()
Vector2
- A two dimensional vector containing the x
and y
position of where the touchpad is being touched. (0,0)
to (1,1)
.The GetTouchpadAxis method returns the coordinates of where the touchpad is being touched and can be used for directional input via the touchpad. The x
value is the horizontal touch plane and the y
value is the vertical touch plane.
public virtual Vector2 GetTouchpadTwoAxis()
Vector2
- A two dimensional vector containing the x
and y
position of where the touchpad two is being touched. (0,0)
to (1,1)
.The GetTouchpadTwoAxis method returns the coordinates of where the touchpad two is being touched and can be used for directional input via the touchpad two. The x
value is the horizontal touch plane and the y
value is the vertical touch plane.
public virtual float GetAxisAngle(Vector2AxisAlias vector2AxisType)
Vector2AxisAlias vector2AxisType
- The Vector2AxisType to get the touch angle for.float
- A float representing the angle of where the given axis type is being touched. 0f
to 360f
.The GetAxisAngle method returns the angle of where the given axis type is currently being touched with the top of the given axis type being 0
degrees and the bottom of the given axis type being 180
degrees.
public virtual float GetTouchpadAxisAngle()
float
- A float representing the angle of where the touchpad is being touched. 0f
to 360f
.The GetTouchpadAxisAngle method returns the angle of where the touchpad is currently being touched with the top of the touchpad being 0
degrees and the bottom of the touchpad being 180
degrees.
public virtual float GetTouchpadTwoAxisAngle()
float
- A float representing the angle of where the touchpad two is being touched. 0f
to 360f
.The GetTouchpadTwoAxisAngle method returns the angle of where the touchpad two is currently being touched with the top of the touchpad two being 0
degrees and the bottom of the touchpad two being 180
degrees.
public virtual float GetTriggerAxis()
float
- A float representing the amount of squeeze that is being applied to the trigger. 0f
to 1f
.The GetTriggerAxis method returns a float that represents how much the trigger is being squeezed. This can be useful for using the trigger axis to perform high fidelity tasks or only activating the trigger press once it has exceeded a given press threshold.
public virtual float GetGripAxis()
float
- A float representing the amount of squeeze that is being applied to the grip. 0f
to 1f
.The GetGripAxis method returns a float that represents how much the grip is being squeezed. This can be useful for using the grip axis to perform high fidelity tasks or only activating the grip press once it has exceeded a given press threshold.
public virtual float GetHairTriggerDelta()
float
- A float representing the difference in the trigger pressure from the hairline threshold start to current position.The GetHairTriggerDelta method returns a float representing the difference in how much the trigger is being pressed in relation to the hairline threshold start.
public virtual float GetHairGripDelta()
float
- A float representing the difference in the trigger pressure from the hairline threshold start to current position.The GetHairTriggerDelta method returns a float representing the difference in how much the trigger is being pressed in relation to the hairline threshold start.
public virtual float GetTouchpadSenseAxis()
float
- A float representing how much the touch sensor is being touched.The GetTouchpadSenseAxis method returns a float representing how much of the touch sensor is being touched.
public virtual float GetTriggerSenseAxis()
float
- A float representing how much the touch sensor is being touched.The GetTriggerSenseAxis method returns a float representing how much of the touch sensor is being touched.
public virtual float GetMiddleFingerSenseAxis()
float
- A float representing how much the touch sensor is being touched.The GetMiddleFingerSenseAxis method returns a float representing how much of the touch sensor is being touched.
public virtual float GetRingFingerSenseAxis()
float
- A float representing how much the touch sensor is being touched.The GetRingFingerSenseAxis method returns a float representing how much of the touch sensor is being touched.
public virtual float GetPinkyFingerSenseAxis()
float
- A float representing how much the touch sensor is being touched.The GetPinkyFingerSenseAxis method returns a float representing how much of the touch sensor is being touched.
public virtual float GetGripSenseAxis()
float
- A float representing how much the touch sensor is being touched.The GetGripSenseAxis method returns a float representing how much of the touch sensor is being touched.
public virtual bool AnyButtonPressed()
bool
- Returns true
if any of the controller buttons are currently being pressed.The AnyButtonPressed method returns true if any of the controller buttons are being pressed and this can be useful to determine if an action can be taken whilst the user is using the controller.
public virtual bool GetAxisState(Vector2AxisAlias axis, SDK_BaseController.ButtonPressTypes pressType)
Vector2AxisAlias axis
- The axis to check on.SDK_BaseController.ButtonPressTypes pressType
- The button press type to check for.bool
- Returns true
if the axis is being interacted with via the given press type.The GetAxisState method takes a given Vector2Axis and returns a boolean whether that given axis is currently being touched or pressed.
public virtual bool IsButtonPressed(ButtonAlias button)
ButtonAlias button
- The button to check if it's being pressed.bool
- Returns true
if the button is being pressed.The IsButtonPressed method takes a given button alias and returns a boolean whether that given button is currently being pressed or not.
public virtual void SubscribeToButtonAliasEvent(ButtonAlias givenButton, bool startEvent, ControllerInteractionEventHandler callbackMethod)
ButtonAlias givenButton
- The Button Alias to register the event on.bool startEvent
- If this is true
then the start event related to the button is used (e.g. OnPress
). If this is false
then the end event related to the button is used (e.g. OnRelease
).ControllerInteractionEventHandler callbackMethod
- The method to subscribe to the event.The SubscribeToButtonAliasEvent method makes it easier to subscribe to a button event on either the start or end action. Upon the event firing, the given callback method is executed.
public virtual void UnsubscribeToButtonAliasEvent(ButtonAlias givenButton, bool startEvent, ControllerInteractionEventHandler callbackMethod)
ButtonAlias givenButton
- The Button Alias to unregister the event on.bool startEvent
- If this is true
then the start event related to the button is used (e.g. OnPress
). If this is false
then the end event related to the button is used (e.g. OnRelease
).ControllerInteractionEventHandler callbackMethod
- The method to unsubscribe from the event.The UnsubscribeToButtonAliasEvent method makes it easier to unsubscribe to from button event on either the start or end action.
public virtual void SubscribeToAxisAliasEvent(SDK_BaseController.ButtonTypes buttonType, AxisType axisType, ControllerInteractionEventHandler callbackMethod)
SDK_BaseController.ButtonTypes buttonType
- The button to listen for axis changes on.AxisType axisType
- The type of axis change to listen for.ControllerInteractionEventHandler callbackMethod
- The method to subscribe to the event.The SubscribeToAxisAliasEvent method makes it easier to subscribe to axis changes on a given button for a given axis type.
public virtual void UnsubscribeToAxisAliasEvent(SDK_BaseController.ButtonTypes buttonType, AxisType axisType, ControllerInteractionEventHandler callbackMethod)
SDK_BaseController.ButtonTypes buttonType
- The button to unregister for axis changes on.AxisType axisType
- The type of axis change to unregister on.ControllerInteractionEventHandler callbackMethod
- The method to unsubscribe from the event.The UnsubscribeToAxisAliasEvent method makes it easier to unsubscribe from axis changes on a given button for a given axis type.
VRTK/Examples/002_Controller_Events
shows how the events are utilised and listened to. The accompanying example script can be viewed in VRTK/Examples/ExampleResources/Scripts/VRTK_ControllerEvents_ListenerExample.cs
.
Determines if a GameObject can initiate a touch with an Interactable Object.
Required Components:
Rigidbody
- A Unity kinematic Rigidbody to determine when collisions happen between the Interact Touch GameObject and other valid colliders.Script Usage:
VRTK_InteractTouch
script on the controller script alias GameObject of the controller to track (e.g. Right Controller Script Alias).ControllerStartTouchInteractableObject
- Emitted when the touch of a valid object has started.ControllerTouchInteractableObject
- Emitted when a valid object is touched.ControllerStartUntouchInteractableObject
- Emitted when the untouch of a valid object has started.ControllerUntouchInteractableObject
- Emitted when a valid object is no longer being touched.ControllerRigidbodyActivated
- Emitted when the controller rigidbody is activated.ControllerRigidbodyDeactivated
- Emitted when the controller rigidbody is deactivated.Adding the VRTK_InteractTouch_UnityEvents
component to VRTK_InteractTouch
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.VRTK_ControllerReference controllerReference
- The reference to the controller doing the interaction.GameObject target
- The GameObject of the Interactable Object that is being interacted with.
public virtual void ForceTouch(GameObject obj)
GameObject obj
- The GameObject to attempt to force touch.The ForceTouch method will attempt to force the Interact Touch onto the given GameObject.
public virtual GameObject GetTouchedObject()
GameObject
- The GameObject of what is currently being touched by this Interact Touch.The GetTouchedObject method returns the current GameObject being touched by the Interact Touch.
public virtual bool IsObjectInteractable(GameObject obj)
GameObject obj
- The GameObject to check to see if it's a valid Interactable Object.bool
- Returns true
if the given GameObjectis a valid Interactable Object.The IsObjectInteractable method is used to check if a given GameObject is a valid Interactable Object.
public virtual void ToggleControllerRigidBody(bool state, bool forceToggle = false)
bool state
- The state of whether the rigidbody is on or off. true
toggles the rigidbody on and false
turns it off.bool forceToggle
- Determines if the rigidbody has been forced into it's new state by another script. This can be used to override other non-force settings. Defaults to false
The ToggleControllerRigidBody method toggles the Interact Touch rigidbody's ability to detect collisions. If it is true then the controller rigidbody will collide with other collidable GameObjects.
public virtual bool IsRigidBodyActive()
bool
- Returns true
if the rigidbody on the Interact Touch is currently active and able to affect other scene rigidbodies.The IsRigidBodyActive method checks to see if the rigidbody on the Interact Touch is active and can affect other rigidbodies in the scene.
public virtual bool IsRigidBodyForcedActive()
bool
- Returns true
if the rigidbody is active and has been forced into the active state.The IsRigidBodyForcedActive method checks to see if the rigidbody on the Interact Touch has been forced into the active state.
public virtual void ForceStopTouching()
The ForceStopTouching method will stop the Interact Touch from touching an Interactable Object even if the Interact Touch is physically touching the Interactable Object.
public virtual Collider[] ControllerColliders()
Collider[]
- An array of colliders that are associated with the controller.The ControllerColliders method retrieves all of the associated colliders on the Interact Touch.
public virtual SDK_BaseController.ControllerType GetControllerType()
SDK_BaseController.ControllerType
- The type of controller that the Interact Touch is attached to.The GetControllerType method is a shortcut to retrieve the current controller type the Interact Touch is attached to.
VRTK/Examples/005_Controller/BasicObjectGrabbing
demonstrates the highlighting of objects that have the VRTK_InteractableObject
script added to them to show the ability to highlight interactable objects when they are touched by the controllers.
Determines if a GameObject can initiate a near touch with an Interactable Object.
Required Components:
VRTK_InteractTouch
- The touch component to determine the actual interacting GameObject that will deal with the near touch interaction. This must be applied on the same GameObject as this script if one is not provided via the Interact Touch
parameter.Script Usage:
VRTK_InteractNearTouch
script on either:
VRTK_InteractTouch
component to the Interact Touch
parameter of this script.Custom Collider Container
is not supplied.ControllerNearTouchInteractableObject
- Emitted when a valid object is near touched.ControllerNearUntouchInteractableObject
- Emitted when a valid object is no longer being near touched.Adding the VRTK_InteractNearTouch_UnityEvents
component to VRTK_InteractNearTouch
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.
public virtual List<GameObject> GetNearTouchedObjects()
List<GameObject>
- A list of GameObjects that are being near touched.The GetNearTouchedObjects method returns all of the GameObjects that are currently being near touched.
public virtual void ForceNearTouch(GameObject obj)
GameObject obj
- The GameObject to attempt to force near touch.The ForceNearTouch method will attempt to force the controller to near touch the given GameObject.
public virtual void ForceStopNearTouching(GameObject obj = null)
GameObject obj
- An optional GameObject to only include in the force stop. If this is null then all near touched GameObjects will be force stopped.The ForceStopNearTouching method will stop the Interact Touch GameObject from near touching an Interactable Object even if the Interact Touch GameObject is physically touching the Interactable Object still.
public virtual List<GameObject> GetNearTouchedObjects()
List<GameObject>
- A list of GameObjects that are being near touched.The GetNearTouchedObjects method returns all of the GameObjects that are currently being near touched.
Determines if the Interact Touch can initiate a grab with the touched Interactable Object.
Required Components:
VRTK_InteractTouch
- The touch component to determine when a valid touch has taken place to denote a grab can occur. This must be applied on the same GameObject as this script if one is not provided via the Interact Touch
parameter.Optional Components:
VRTK_ControllerEvents
- The events component to listen for the button presses on. This must be applied on the same GameObject as this script if one is not provided via the Controller Events
parameter.Script Usage:
VRTK_InteractGrab
script on either:
VRTK_ControllerEvents
component to the Controller Events
parameter and a valid VRTK_InteractTouch
component to the Interact Touch
parameter of this script.GrabButtonPressed
- Emitted when the grab button is pressed.GrabButtonReleased
- Emitted when the grab button is released.ControllerStartGrabInteractableObject
- Emitted when a grab of a valid object is started.ControllerGrabInteractableObject
- Emitted when a valid object is grabbed.ControllerStartUngrabInteractableObject
- Emitted when a ungrab of a valid object is started.ControllerUngrabInteractableObject
- Emitted when a valid object is released from being grabbed.Adding the VRTK_InteractGrab_UnityEvents
component to VRTK_InteractGrab
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.
public virtual bool IsGrabButtonPressed()
bool
- Returns true
if the grab alias button is being held down.The IsGrabButtonPressed method determines whether the current grab alias button is being pressed down.
public virtual void ForceRelease(bool applyGrabbingObjectVelocity = false)
bool applyGrabbingObjectVelocity
- If this is true then upon releasing the Interactable Object any velocity on the Interact Touch GameObject will be applied to the Interactable Object to essentiall throw it. Defaults to false
.The ForceRelease method will force the Interact Grab to stop grabbing the currently grabbed Interactable Object.
public virtual void AttemptGrab()
The AttemptGrab method will attempt to grab the currently touched Interactable Object without needing to press the grab button on the controller.
public virtual GameObject GetGrabbedObject()
GameObject
- The game object of what is currently being grabbed by this controller.The GetGrabbedObject method returns the current Interactable Object being grabbed by the this Interact Grab.
public virtual void ForceControllerAttachPoint(Rigidbody forcedAttachPoint)
Rigidbody forcedAttachPoint
- The rigidbody to use as the controller attach point.The ForceControllerAttachPoint method updates the rigidbody being used as the controller grab attach position.
VRTK/Examples/005_Controller/BasicObjectGrabbing
demonstrates the grabbing of interactable objects that have the VRTK_InteractableObject
script attached to them. The objects can be picked up and thrown around.
VRTK/Examples/013_Controller_UsingAndGrabbingMultipleObjects
demonstrates that each controller can grab and use objects independently and objects can also be toggled to their use state simultaneously.
VRTK/Examples/014_Controller_SnappingObjectsOnGrab
demonstrates the different mechanisms for snapping a grabbed object to the controller.
Determines if the Interact Touch can initiate a use interaction with the touched Interactable Object.
Required Components:
VRTK_InteractTouch
- The touch component to determine when a valid touch has taken place to denote a use interaction can occur. This must be applied on the same GameObject as this script if one is not provided via the Interact Touch
parameter.Optional Components:
VRTK_ControllerEvents
- The events component to listen for the button presses on. This must be applied on the same GameObject as this script if one is not provided via the Controller Events
parameter.VRTK_InteractGrab
- The grab component to determine when a valid grab has taken place. This must be applied on the same GameObject as this script if one is not provided via the Interact Grab
parameter.Script Usage:
VRTK_InteractUse
script on either:
VRTK_ControllerEvents
component to the Controller Events
parameter and a valid VRTK_InteractTouch
component to the Interact Touch
parameter of this script.UseButtonPressed
- Emitted when the use toggle alias button is pressed.UseButtonReleased
- Emitted when the use toggle alias button is released.ControllerStartUseInteractableObject
- Emitted when a use of a valid object is started.ControllerUseInteractableObject
- Emitted when a valid object starts being used.ControllerStartUnuseInteractableObject
- Emitted when a unuse of a valid object is started.ControllerUnuseInteractableObject
- Emitted when a valid object stops being used.Adding the VRTK_InteractUse_UnityEvents
component to VRTK_InteractUse
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.
public virtual bool IsUseButtonPressed()
bool
- Returns true
if the use alias button is being held down.The IsUsebuttonPressed method determines whether the current use alias button is being pressed down.
public virtual GameObject GetUsingObject()
GameObject
- The GameObject of what is currently being used by this Interact Use.The GetUsingObject method returns the current GameObject being used by the Interact Use.
public virtual void ForceStopUsing()
The ForceStopUsing method will force the Interact Use to stop using the currently touched Interactable Object and will also stop the Interactable Object's using action.
public virtual void ForceResetUsing()
The ForceResetUsing will force the Interact Use to stop using the currently touched Interactable Object but the Interactable Object will continue with it's existing using action.
public virtual void AttemptUse()
The AttemptUse method will attempt to use the currently touched Interactable Object without needing to press the use button on the controller.
VRTK/Examples/006_Controller_UsingADoor
simulates using a door object to open and close it. It also has a cube on the floor that can be grabbed to show how interactable objects can be usable or grabbable.
VRTK/Examples/008_Controller_UsingAGrabbedObject
shows that objects can be grabbed with one button and used with another (e.g. firing a gun).
extends VRTK_SDKControllerReady
Provides a controller collider collection that follows the controller rigidbody via the physics system.
Required Components:
VRTK_InteractTouch
- An Interact Touch script to determine which controller rigidbody to follow.Optional Components:
VRTK_ControllerEvents
- The events component to listen for the button presses on. This must be applied in the same object hierarchy as the Interact Touch script if one is not provided via the Controller Events
parameter.Script Usage:
VRTK_ControllerTrackedCollider
script on any active scene GameObject except the Script Alias objects.Interact Touch
parameter on this script.Undefined
then it will always be active.Interact Touch
parameter.
public virtual void ToggleColliders(bool state)
bool state
- If true
then the tracked colliders will be able to affect other Rigidbodies.The ToggleColliders method toggles the collision state of the tracked colliders.
public virtual Collider[] TrackedColliders()
Collider[]
- A Collider array of the tracked colliders.The TrackedColliders method returns an array of the tracked colliders.
Enables highlighting of controller elements.
Optional Components:
VRTK_BaseHighlighter
- The highlighter to use when highligting the controller. If one is not already injected in the Controller Highlighter
parameter then the component on the same GameObject will be used.Script Usage:
VRTK_ControllerHighlighter
script on either:
Controller Alias
parameter of this script.Controller Highlighter
parameter.
public virtual void ConfigureControllerPaths()
The ConfigureControllerPaths method is used to set up the model element paths.
public virtual void PopulateHighlighters()
The PopulateHighlighters method sets up the highlighters on the controller model.
public virtual void HighlightController(Color color, float fadeDuration = 0f)
Color color
- The Color to highlight the controller to.float fadeDuration
- The duration in seconds to fade from the initial color to the target color.The HighlightController method attempts to highlight all sub models of the controller.
public virtual void UnhighlightController()
The UnhighlightController method attempts to remove the highlight from all sub models of the controller.
public virtual void HighlightElement(SDK_BaseController.ControllerElements elementType, Color color, float fadeDuration = 0f)
SDK_BaseController.ControllerElements elementType
- The element type on the controller.Color color
- The Color to highlight the controller element to.float fadeDuration
- The duration in seconds to fade from the initial color to the target color.The HighlightElement method attempts to highlight a specific controller element.
public virtual void UnhighlightElement(SDK_BaseController.ControllerElements elementType)
SDK_BaseController.ControllerElements elementType
- The element type on the controller.The UnhighlightElement method attempts to remove the highlight from the specific controller element.
VRTK/Examples/035_Controller_OpacityAndHighlighting
demonstrates the ability to change the opacity of a controller model and to highlight specific elements of a controller such as the buttons or even the entire controller model.
Attempt to automatically grab a specified Interactable Object.
Required Components:
VRTK_InteractTouch
- The touch component to determine when a valid touch has taken place to denote a use interaction can occur. This must be applied on the same GameObject as this script if one is not provided via the Interact Touch
parameter.VRTK_InteractGrab
- The grab component to determine when a valid grab has taken place. This must be applied on the same GameObject as this script if one is not provided via the Interact Grab
parameter.Script Usage:
VRTK_ObjectAutoGrab
script on either:
VRTK_InteractTouch
component to the Interact Touch
parameter and a valid VRTK_InteractGrab
component to the Interact Grab
parameter of this script.Object To Grab
parameter on this script.Object Is Prefab
parameter on this script must be checked.Object To Grab
is a prefab then this needs to be checked, if the Object To Grab
already exists in the scene then this needs to be unchecked.Object To Grab
will be cloned into a new Interactable Object and grabbed by the Interact Grab leaving the existing Interactable Object in the scene. This is required if the same Interactable Object is to be grabbed to multiple instances of Interact Grab. It is also required to clone a grabbed Interactable Object if it is a prefab as it needs to exist within the scene to be grabbed.Clone Grabbed Object
is checked and this is checked, then whenever this script is disabled and re-enabled, it will always create a new clone of the Interactable Object to grab. If this is unchecked then the original cloned Interactable Object will attempt to be grabbed again. If the original cloned object no longer exists then a new clone will be created.Object To Grab
will attempt to be secondary grabbed as well as primary grabbed.ObjectAutoGrabCompleted
- Emitted when the object auto grab has completed successfully.Adding the VRTK_ObjectAutoGrab_UnityEvents
component to VRTK_ObjectAutoGrab
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.
public virtual void ClearPreviousClone()
The ClearPreviousClone method resets the previous cloned Interactable Object to null to ensure when the script is re-enabled that a new cloned Interactable Object is created, rather than the original clone being grabbed again.
VRTK/Examples/026_Controller_ForceHoldObject
shows how to automatically grab a sword to each controller and also prevents the swords from being dropped so they are permanently attached to the user's controllers.
A collection of scripts that provide the ability denote objects as being interactable and providing functionality when an object is interected with.
Determines if the GameObject can be interacted with.
Required Components:
Collider
- A Unity Collider to determine when an interaction has occured. Can be a compound collider set in child GameObjects.Optional Components:
Rigidbody
- A Unity Rigidbody to allow the GameObject to be affected by the Unity Physics System (not required for Climbable Grab Attach Types).VRTK_BaseGrabAttach
- A Grab Attach mechanic for determining how the Interactable Object is grabbed by the primary interacting object.VRTK_BaseGrabAction
- A Grab Action mechanic for determining how to manipulate the Interactable Object when grabbed by the secondary interacting object.Script Usage:
VRTK_InteractableObject
script onto the GameObject that is to be interactable.Window -> VRTK -> Setup Interactable Object
panel to set up quickly.Object Highlighter
parameter.Script Dependencies:
Undefined
will mean the Grab Button
on the Interact Grab script will grab the object.Hold Button To Use
parameter is unchecked then whilst the Pointer is collising with the Interactable Object it will run the Using
method. If Hold Button To Use
is unchecked then the Using
method will be run when the Pointer is deactivated. The Pointer will not emit the Destination Set
event if it is affecting an Interactable Object with this setting checked as this prevents unwanted teleporting from happening when using an Interactable Object with a pointer.Undefined
will mean the Use Button
on the Interact Use script will use the object.public enum InteractionType
- The interaction type.
None
- No interaction is affecting the object.NearTouch
- The near touch interaction is affecting the object.NearUntouch
- The near untouch interaction stopped affecting the objectTouch
- The touch interaction is affecting the object.Untouch
- The untouch interaction stopped affecting the objectGrab
- The grab interaction is affecting the object.Ungrab
- The ungrab interaction stopped affecting the objectUse
- The use interaction is affecting the object.Unuse
- The unuse interaction stopped affecting the objectpublic enum AllowedController
- Allowed controller type.
Both
- Both controllers are allowed to interact.LeftOnly
- Only the left controller is allowed to interact.RightOnly
- Only the right controller is allowed to interact.public enum ValidDropTypes
- The types of valid situations that the object can be released from grab.
NoDrop
- The object cannot be dropped via the controller.DropAnywhere
- The object can be dropped anywhere in the scene via the controller.DropValidSnapDropZone
- The object can only be dropped when it is hovering over a valid snap drop zone.public int usingState
- The current using state of the Interactable Object. 0
not being used, 1
being used. Default: 0
public bool isKinematic
- isKinematic is a pass through to the isKinematic
getter/setter on the Interactable Object's Rigidbody component.InteractableObjectEnabled
- Emitted when the Interactable Object script is enabled;InteractableObjectDisabled
- Emitted when the Interactable Object script is disabled;InteractableObjectNearTouched
- Emitted when another interacting object near touches the current Interactable Object.InteractableObjectNearUntouched
- Emitted when the other interacting object stops near touching the current Interactable Object.InteractableObjectTouched
- Emitted when another interacting object touches the current Interactable Object.InteractableObjectUntouched
- Emitted when the other interacting object stops touching the current Interactable Object.InteractableObjectGrabbed
- Emitted when another interacting object grabs the current Interactable Object.InteractableObjectUngrabbed
- Emitted when the other interacting object stops grabbing the current Interactable Object.InteractableObjectUsed
- Emitted when another interacting object uses the current Interactable Object.InteractableObjectUnused
- Emitted when the other interacting object stops using the current Interactable Object.InteractableObjectEnteredSnapDropZone
- Emitted when the Interactable Object enters a Snap Drop Zone.InteractableObjectExitedSnapDropZone
- Emitted when the Interactable Object exists a Snap Drop Zone.InteractableObjectSnappedToDropZone
- Emitted when the Interactable Object gets snapped to a Snap Drop Zone.InteractableObjectUnsnappedFromDropZone
- Emitted when the Interactable Object gets unsnapped from a Snap Drop Zone.Adding the VRTK_InteractableObject_UnityEvents
component to VRTK_InteractableObject
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.GameObject interactingObject
- The GameObject that is initiating the interaction (e.g. a controller).
public virtual bool IsNearTouched()
bool
- Returns true
if the Interactable Object is currently being near touched.The IsNearTouched method is used to determine if the Interactable Object is currently being near touched.
public virtual bool IsTouched()
bool
- Returns true
if the Interactable Object is currently being touched.The IsTouched method is used to determine if the Interactable Object is currently being touched.
public virtual bool IsGrabbed(GameObject grabbedBy = null)
GameObject grabbedBy
- An optional GameObject to check if the Interactable Object is grabbed by that specific GameObject. Defaults to null
bool
- Returns true
if the Interactable Object is currently being grabbed.The IsGrabbed method is used to determine if the Interactable Object is currently being grabbed.
public virtual bool IsUsing(GameObject usedBy = null)
GameObject usedBy
- An optional GameObject to check if the Interactable Object is used by that specific GameObject. Defaults to null
bool
- Returns true
if the Interactable Object is currently being used.The IsUsing method is used to determine if the Interactable Object is currently being used.
public virtual void StartNearTouching(VRTK_InteractNearTouch currentNearTouchingObject = null)
VRTK_InteractNearTouch currentNearTouchingObject
- The interacting object that is currently nearly touching this Interactable Object.The StartNearTouching method is called automatically when the Interactable Object is initially nearly touched.
public virtual void StopNearTouching(VRTK_InteractNearTouch previousNearTouchingObject = null)
VRTK_InteractNearTouch previousNearTouchingObject
- The interacting object that was previously nearly touching this Interactable Object.The StopNearTouching method is called automatically when the Interactable Object has stopped being nearly touched.
public virtual void StartTouching(VRTK_InteractTouch currentTouchingObject = null)
VRTK_InteractTouch currentTouchingObject
- The interacting object that is currently touching this Interactable Object.The StartTouching method is called automatically when the Interactable Object is touched initially.
public virtual void StopTouching(VRTK_InteractTouch previousTouchingObject = null)
VRTK_InteractTouch previousTouchingObject
- The interacting object that was previously touching this Interactable Object.The StopTouching method is called automatically when the Interactable Object has stopped being touched.
public virtual void Grabbed(VRTK_InteractGrab currentGrabbingObject = null)
VRTK_InteractGrab currentGrabbingObject
- The interacting object that is currently grabbing this Interactable Object.The Grabbed method is called automatically when the Interactable Object is grabbed initially.
public virtual void Ungrabbed(VRTK_InteractGrab previousGrabbingObject = null)
VRTK_InteractGrab previousGrabbingObject
- The interacting object that was previously grabbing this Interactable Object.The Ungrabbed method is called automatically when the Interactable Object has stopped being grabbed.
public virtual void StartUsing(VRTK_InteractUse currentUsingObject = null)
VRTK_InteractUse currentUsingObject
- The interacting object that is currently using this Interactable Object.The StartUsing method is called automatically when the Interactable Object is used initially.
public virtual void StopUsing(VRTK_InteractUse previousUsingObject = null, bool resetUsingObjectState = true)
VRTK_InteractUse previousUsingObject
- The interacting object that was previously using this Interactable Object.bool resetUsingObjectState
- Resets the using object state to reset it's using action.The StopUsing method is called automatically when the Interactable Object has stopped being used.
public virtual void PauseCollisions(float delay)
float delay
- The time in seconds to pause the collisions for.The PauseCollisions method temporarily pauses all collisions on the Interactable Object at grab time by removing the Interactable Object's Rigidbody's ability to detect collisions.
public virtual void ZeroVelocity()
The ZeroVelocity method resets the velocity and angular velocity to zero on the Rigidbody attached to the Interactable Object.
public virtual void SaveCurrentState()
The SaveCurrentState method stores the existing Interactable Object parent and the Rigidbody kinematic setting.
public virtual void GetPreviousState(out Transform previousParent, out bool previousKinematic, out bool previousGrabbable)
out Transform previousParent
- Out param for the previous parentout bool previousKinematic
- Out param for the previous Kinematic stateout bool previousGrabbable
- Out param for the previous Grabbable StateReturns the previous state of the Interactable Object
public virtual void OverridePreviousState(Transform previousParent, bool previousKinematic, bool previousGrabbable)
Transform previousParent
- value of the previous parentbool previousKinematic
- value of the previous Kinematic statebool previousGrabbable
- value of the previous Grabbable StateOverrides the previous state of the Interactable Object
public virtual List<GameObject> GetNearTouchingObjects()
List<GameObject>
- A list of GameObject of that are currently nearly touching the current Interactable Object.The GetNearTouchingObjects method is used to return the collecetion of valid GameObjects that are currently nearly touching this Interactable Object.
public virtual List<GameObject> GetTouchingObjects()
List<GameObject>
- A list of GameObject of that are currently touching the current Interactable Object.The GetTouchingObjects method is used to return the collecetion of valid GameObjects that are currently touching this Interactable Object.
public virtual GameObject GetGrabbingObject()
GameObject
- The GameObject of what is grabbing the current Interactable Object.The GetGrabbingObject method is used to return the GameObject that is currently grabbing this Interactable Object.
public virtual GameObject GetSecondaryGrabbingObject()
GameObject
- The GameObject of the secondary influencing object of the current grabbed Interactable Object.The GetSecondaryGrabbingObject method is used to return the GameObject that is currently being used to influence this Interactable Object whilst it is being grabbed by a secondary influencing.
public virtual GameObject GetUsingObject()
GameObject
- The GameObject of what is using the current Interactable Object.The GetUsingObject method is used to return the GameObject that is currently using this Interactable Object.
public virtual VRTK_InteractUse GetUsingScript()
VRTK_InteractUse
- The Interact Use script of the interacting object that is using the current Interactable Object.The GetUsingScript method is used to return the Interact Use component that is currently using this Interactable Object.
public virtual bool IsValidInteractableController(GameObject actualController, AllowedController controllerCheck)
GameObject actualController
- The GameObject of the controller that is being checked.AllowedController controllerCheck
- The value of which controller is allowed to interact with this object.bool
- Returns true
if the interacting controller is allowed to grab the Interactable Object.The IsValidInteractableController method is used to check to see if a controller is allowed to perform an interaction with this Interactable Object as sometimes controllers are prohibited from grabbing or using an Interactable Object depedning on the use case.
public virtual void ForceStopInteracting()
The ForceStopInteracting method forces the Interactable Object to no longer be interacted with and will cause an interacting object to drop the Interactable Object and stop touching it.
public virtual void ForceStopSecondaryGrabInteraction()
The ForceStopSecondaryGrabInteraction method forces the Interactable Object to no longer be influenced by the second controller grabbing it.
public virtual void RegisterTeleporters()
The RegisterTeleporters method is used to find all GameObjects that have a teleporter script and register the Interactable Object on the OnTeleported
event.
public virtual void UnregisterTeleporters()
The UnregisterTeleporters method is used to unregister all teleporter events that are active on this Interactable Object.
public virtual void StoreLocalScale()
the StoreLocalScale method saves the current transform local scale values.
public virtual void ToggleSnapDropZone(VRTK_SnapDropZone snapDropZone, bool state)
VRTK_SnapDropZone snapDropZone
- The Snap Drop Zone object that is being interacted with.bool state
- The state of whether the Interactable Object is fixed in or removed from the Snap Drop Zone. true
denotes the Interactable Object is snapped to the Snap Drop Zone and false
denotes it has been removed from the Snap Drop Zone.The ToggleSnapDropZone method is used to set the state of whether the Interactable Object is in a Snap Drop Zone or not.
public virtual bool IsInSnapDropZone()
bool
- Returns true
if the Interactable Object is currently snapped in a Snap Drop Zone, returns false
if it is not.The IsInSnapDropZone method determines whether the Interactable Object is currently snapped to a Snap Drop Zone.
public virtual void SetSnapDropZoneHover(VRTK_SnapDropZone snapDropZone, bool state)
VRTK_SnapDropZone snapDropZone
- The Snap Drop Zone that is being interacted with.bool state
- The state of whether the Interactable Object is being hovered or not.The SetSnapDropZoneHover method sets whether the Interactable Object is currently being hovered over a valid Snap Drop Zone.
public virtual VRTK_SnapDropZone GetStoredSnapDropZone()
VRTK_SnapDropZone
- The SnapDropZone that the Interactable Object is currently snapped to.The GetStoredSnapDropZone method returns the Snap Drop Zone that the Interactable Object is currently snapped to.
public virtual bool IsHoveredOverSnapDropZone()
bool
- Returns true
if the Interactable Object is currently hovering over a Snap Drop Zone.The IsHoveredOverSnapDropZone method returns whether the Interactable Object is currently hovering over a Snap Drop Zone.
public virtual bool IsDroppable()
bool
- Returns true
if the Interactable Object can currently be dropped, returns false
if it is not currently possible to drop.The IsDroppable method returns whether the Interactable Object can be dropped or not in it's current situation.
public virtual bool IsSwappable()
bool
- Returns true
if the Interactable Object can be grabbed by a secondary interacting object whilst already being grabbed and the Interactable Object will swap controllers. Returns false
if the Interactable Object cannot be swapped.The IsSwappable method returns whether the Interactable Object can be grabbed with one interacting object and then swapped to another interacting object by grabbing with the secondary grab action.
public virtual bool PerformSecondaryAction()
bool
- Returns true
if the Interactable Object has a Secondary Grab Action, returns false
if it has no Secondary Grab Action or is swappable.The PerformSecondaryAction method returns whether the Interactable Object has a Secondary Grab Action that can be performed when grabbing the object with a secondary interacting object.
public virtual void ResetIgnoredColliders()
The ResetIgnoredColliders method is used to clear any stored ignored colliders in case the Ignored Colliders
array parameter is changed at runtime. This needs to be called manually if changes are made at runtime.
public virtual void SubscribeToInteractionEvent(InteractionType givenType, InteractableObjectEventHandler methodCallback)
InteractionType givenType
- The Interaction Type to register the events for.InteractableObjectEventHandler methodCallback
- The method to execute when the Interaction Type is initiated.The SubscribeToInteractionEvent method subscribes a given method callback for the given Interaction Type.
public virtual void UnsubscribeFromInteractionEvent(InteractionType givenType, InteractableObjectEventHandler methodCallback)
InteractionType givenType
- The Interaction Type that the previous event subscription was under.InteractableObjectEventHandler methodCallback
- The method that was being executed when the Interaction Type was initiated.The UnsubscribeFromInteractionEvent method unsubscribes a previous event subscription for the given Interaction Type.
public virtual Transform GetPrimaryAttachPoint()
Transform
- A Transform that denotes where the primary grabbing object is grabbing the Interactable Object at.The GetPrimaryAttachPoint returns the Transform that determines where the primary grabbing object is grabbing the Interactable Object at.
public virtual Transform GetSecondaryAttachPoint()
Transform
- A Transform that denotes where the secondary grabbing object is grabbing the Interactable Object at.The GetSecondaryAttachPoint returns the Transform that determines where the secondary grabbing object is grabbing the Interactable Object at.
VRTK/Examples/005_Controller_BasicObjectGrabbing
uses the VRTK_InteractTouch
and VRTK_InteractGrab
scripts on the controllers to show how an interactable object can be grabbed and snapped to the controller and thrown around the game world.
VRTK/Examples/013_Controller_UsingAndGrabbingMultipleObjects
shows multiple objects that can be grabbed by holding the buttons or grabbed by toggling the button click and also has objects that can have their Using state toggled to show how multiple items can be turned on at the same time.
Provides a base that classes which require to subscribe to the interaction events of an Interactable Object can inherit from.
Script Usage:
This is an abstract class that is to be inherited to a concrete class that provides interaction event listener functionality, therefore this script should not be directly used.
extends VRTK_InteractableListener
Provides controller haptics upon interaction with the specified Interactable Object.
Required Components:
VRTK_InteractableObject
- The Interactable Object component to detect interactions on. This must be applied on the same GameObject as this script if one is not provided via the Object To Affect
parameter.Script Usage:
VRTK_InteractHaptics
script on either:
VRTK_InteractableObject
component to the Object To Affect
parameter of this script.InteractHapticsNearTouched
- Emitted when the haptics are from a near touch.InteractHapticsTouched
- Emitted when the haptics are from a touch.InteractHapticsGrabbed
- Emitted when the haptics are from a grab.InteractHapticsUsed
- Emitted when the haptics are from a use.Adding the VRTK_InteractHaptics_UnityEvents
component to VRTK_InteractHaptics
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.VRTK_ControllerReference controllerReference
- The reference to the controller to perform haptics on.
public virtual void CancelHaptics(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
-The CancelHaptics method cancels any existing haptic feedback on the given controller.
public virtual void HapticsOnNearTouch(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to activate the haptic feedback on.The HapticsOnNearTouch method triggers the haptic feedback on the given controller for the settings associated with near touch.
public virtual void HapticsOnTouch(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to activate the haptic feedback on.The HapticsOnTouch method triggers the haptic feedback on the given controller for the settings associated with touch.
public virtual void HapticsOnGrab(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to activate the haptic feedback on.The HapticsOnGrab method triggers the haptic feedback on the given controller for the settings associated with grab.
public virtual void HapticsOnUse(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to activate the haptic feedback on.The HapticsOnUse method triggers the haptic feedback on the given controller for the settings associated with use.
extends VRTK_InteractableListener
Determine whether the Object To Affect
should be visible or hidden by default or on interaction (near touch, touch, grab, use).
Required Components:
VRTK_InteractableObject
- The Interactable Object component to detect interactions on. This must be applied on the same GameObject as this script if one is not provided via the Object To Monitor
parameter.Script Usage:
VRTK_InteractObjectAppearance
script on either:
VRTK_InteractableObject
component to the Object To Monitor
parameter of this script.Object To Affect
parameter to determine which GameObject to affect the appearance of.Object To Affect
will be an active GameObject when the script is enabled. If it's unchecked then it will be disabled. This only takes effect if Affect Interacting Object
is unticked.Object To Affect
will have visible renderers when the script is enabled. If it's unchecked then it will have it's renderers disabled. This only takes effect if Affect Interacting Object
is unticked.Object To Affect
will be an active GameObject when the Object To Monitor
is near touched. If it's unchecked then it will be disabled on near touch.Object To Affect
will have visible renderers when the Object To Monitor
is near touched. If it's unchecked then it will have it's renderers disabled on near touch.Object To Affect
after the near touch and near untouch event.Object To Affect
will be an active GameObject when the Object To Monitor
is touched. If it's unchecked then it will be disabled on touch.Object To Affect
will have visible renderers when the Object To Monitor
is touched. If it's unchecked then it will have it's renderers disabled on touch.Object To Affect
after the touch/untouch event.Object To Affect
will be an active GameObject when the Object To Monitor
is grabbed. If it's unchecked then it will be disabled on grab.Object To Affect
will have visible renderers when the Object To Monitor
is grabbed. If it's unchecked then it will have it's renderers disabled on grab.Object To Affect
after the grab/ungrab event.Object To Affect
will be an active GameObject when the Object To Monitor
is used. If it's unchecked then it will be disabled on use.Object To Affect
will have visible renderers when the Object To Monitor
is used. If it's unchecked then it will have it's renderers disabled on use.Object To Affect
after the use/unuse event.public enum ValidInteractingObject
- The valid interacting object.
Anything
- Any GameObject is considered a valid interacting object.EitherController
- Only a game controller is considered a valid interacting objcet.NeitherController
- Any GameObject except a game controller is considered a valid interacting object.LeftControllerOnly
- Only the left game controller is considered a valid interacting objcet.RightControllerOnly
- Only the right game controller is considered a valid interacting objcet.GameObjectEnabled
- Emitted when the GameObject on the Object To Affect
is enabled.GameObjectDisabled
- Emitted when the GameObject on the Object To Affect
is disabled.RenderersEnabled
- Emitted when the Renderers on the Object To Affect
are enabled.RenderersDisabled
- Emitted when the Renderers on the Object To Affect
are disabled.Adding the VRTK_InteractObjectAppearance_UnityEvents
component to VRTK_InteractObjectAppearance
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.GameObject affectingObject
- The GameObject that is being affected.VRTK_InteractableObject monitoringObject
- The Interactable Object that is being monitored.VRTK_InteractableObject.InteractionType interactionType
- The type of interaction initiating the event.VRTK/Examples/008_Controller_UsingAGrabbedObject
shows that the controller can be hidden when touching, grabbing and using an object.
extends VRTK_InteractableListener
Enable highlighting of an Interactable Object base on interaction type.
Required Components:
VRTK_InteractableObject
- The Interactable Object component to detect interactions on. This must be applied on the same GameObject as this script if one is not provided via the Object To Monitor
parameter.Optional Components:
VRTK_BaseHighlighter
- The highlighter to use when highligting the Object. If one is not already injected in the Object Highlighter
parameter then the component on the same GameObject will be used.Script Usage:
VRTK_InteractObjectHighlighter
script on either:
VRTK_InteractableObject
component to the Object To Affect
parameter of this script.InteractObjectHighlighterHighlighted
- Emitted when the object is highlightedInteractObjectHighlighterUnhighlighted
- Emitted when the object is unhighlightedAdding the VRTK_InteractObjectHighlighter_UnityEvents
component to VRTK_InteractObjectHighlighter
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.VRTK_InteractableObject.InteractionType interactionType
- The type of interaction occuring on the object to monitor.Color highlightColor
- The colour being provided to highlight the affected object with.GameObject affectingObject
- The GameObject is initiating the highlight via an interaction.VRTK_InteractableObject objectToMonitor
- The Interactable Object that is being interacted with.GameObject affectedObject
- The GameObject that is being highlighted.
public virtual void ResetHighlighter()
The ResetHighlighter method is used to reset the currently attached highlighter.
public virtual void Highlight(Color highlightColor)
Color highlightColor
- The colour to apply to the highlighter.The Highlight method turns on the highlighter with the given Color.
public virtual void Unhighlight()
The Unhighlight method turns off the highlighter.
public virtual Color GetCurrentHighlightColor()
Color
- The Color that the Interactable Object is being highlighted to.The GetCurrentHighlightColor returns the colour that the Interactable Object is currently being highlighted to.
extends VRTK_InteractableListener
Allows for Interact Grab or Interact Use interactions to automatically happen upon touching an Interactable Object.
Required Components:
VRTK_InteractableObject
- The Interactable Object component to detect interactions on. This must be applied on the same GameObject as this script if one is not provided via the Interactable Object
parameter.Script Usage:
VRTK_ObjectTouchAutoInteract
script on either:
VRTK_InteractableObject
component to the Interactable Object
parameter of this script.public enum AutoInteractions
- Situation when auto interaction can occur.
Never
- Auto interaction can never occur on touch.NoButtonHeld
- Auto interaction will occur on touch even if the specified interaction button is not held down.ButtonHeld
- Auto interaction will only occur on touch if the specified interaction button is held down.extends VRTK_SDKControllerReady
Ignores the collisions between the given Interact Touch colliders and the colliders on the GameObject this script is attached to.
Required Components:
Collider
- Unity Colliders on the current GameObject or child GameObjects to ignore collisions from the given Interact Touch colliders.Script Usage:
VRTK_IgnoreInteractTouchColliders
script on the GameObject with colliders to ignore collisions from the given Interact Touch colliders.Interact Touch To Ignore
element list.VRTK_InteractTouch
script attached to use when ignoring collisions with the colliders on GameObject the script is attached to.A collection of scripts that are used to provide different mechanics to apply when grabbing an interactable object.
Provides a base that all grab attach mechanics can inherit from.
Script Usage:
This is an abstract class that is to be inherited to a concrete class that provides grab attach functionality, therefore this script should not be directly used.
Precision Grab
.Precision Grab
.
public virtual bool IsTracked()
bool
- Is true if the mechanic is of type tracked.The IsTracked method determines if the grab attach mechanic is a track object type.
public virtual bool IsClimbable()
bool
- Is true if the mechanic is of type climbable.The IsClimbable method determines if the grab attach mechanic is a climbable object type.
public virtual bool IsKinematic()
bool
- Is true if the mechanic is of type kinematic.The IsKinematic method determines if the grab attach mechanic is a kinematic object type.
public virtual bool ValidGrab(Rigidbody checkAttachPoint)
Rigidbody checkAttachPoint
- The rigidbody attach point to check.bool
- Always returns true
for the base check.The ValidGrab method determines if the grab attempt is valid.
public virtual void SetTrackPoint(Transform givenTrackPoint)
Transform givenTrackPoint
- The track point to set on the grabbed Interactable Object.The SetTrackPoint method sets the point on the grabbed Interactable Object where the grab is happening.
public virtual void SetInitialAttachPoint(Transform givenInitialAttachPoint)
Transform givenInitialAttachPoint
- The point where the initial grab took place.The SetInitialAttachPoint method sets the point on the grabbed Interactable Object where the initial grab happened.
public virtual bool StartGrab(GameObject grabbingObject, GameObject givenGrabbedObject, Rigidbody givenControllerAttachPoint)
GameObject grabbingObject
- The GameObject that is doing the grabbing.GameObject givenGrabbedObject
- The GameObject that is being grabbed.Rigidbody givenControllerAttachPoint
- The point on the grabbing object that the grabbed object should be attached to after grab occurs.bool
- Returns true
if the grab is successful, false
if the grab is unsuccessful.The StartGrab method sets up the grab attach mechanic as soon as an Interactable Object is grabbed.
public virtual void StopGrab(bool applyGrabbingObjectVelocity)
bool applyGrabbingObjectVelocity
- If true
will apply the current velocity of the grabbing object to the grabbed object on release.The StopGrab method ends the grab of the current Interactable Object and cleans up the state.
public virtual Transform CreateTrackPoint(Transform controllerPoint, GameObject currentGrabbedObject, GameObject currentGrabbingObject, ref bool customTrackPoint)
Transform controllerPoint
- The point on the controller where the grab was initiated.GameObject currentGrabbedObject
- The GameObject that is currently being grabbed.GameObject currentGrabbingObject
- The GameObject that is currently doing the grabbing.ref bool customTrackPoint
- A reference to whether the created track point is an auto generated custom object.Transform
- The Transform of the created track point.The CreateTrackPoint method sets up the point of grab to track on the grabbed object.
public virtual void ProcessUpdate()
The ProcessUpdate method is run in every Update method on the Interactable Object.
public virtual void ProcessFixedUpdate()
The ProcessFixedUpdate method is run in every FixedUpdate method on the Interactable Object.
public virtual void ResetState()
The ResetState method re-initializes the grab attach.
extends VRTK_BaseGrabAttach
Provides a base that all joint based grab attach mechanics can inherit from.
Script Usage:
This is an abstract class that is to be inherited to a concrete class that provides joint based grab attach functionality, therefore this script should not be directly used.
public override bool ValidGrab(Rigidbody checkAttachPoint)
Rigidbody checkAttachPoint
- The rigidbody attach point to check.bool
- Returns true
if there is no current grab happening, or the grab is initiated by another grabbing object.The ValidGrab method determines if the grab attempt is valid.
public override bool StartGrab(GameObject grabbingObject, GameObject givenGrabbedObject, Rigidbody givenControllerAttachPoint)
GameObject grabbingObject
- The GameObject that is doing the grabbing.GameObject givenGrabbedObject
- The GameObject that is being grabbed.Rigidbody givenControllerAttachPoint
- The point on the grabbing object that the grabbed object should be attached to after grab occurs.bool
- Returns true
if the grab is successful, false
if the grab is unsuccessful.The StartGrab method sets up the grab attach mechanic as soon as an Interactable Object is grabbed. It is also responsible for creating the joint on the grabbed object.
public override void StopGrab(bool applyGrabbingObjectVelocity)
bool applyGrabbingObjectVelocity
- If true
will apply the current velocity of the grabbing object to the grabbed object on release.The StopGrab method ends the grab of the current Interactable Object and cleans up the state. It is also responsible for removing the joint from the grabbed object.
extends VRTK_BaseJointGrabAttach
Attaches the grabbed Interactable Object to the grabbing object via a Fixed Joint.
The Interactable Object will be attached to the grabbing object via a Fixed Joint and the Joint can be broken upon colliding the Interactable Object with other colliders.
Script Usage:
VRTK_FixedJointGrabAttach
script on either:
Grab Attach Mechanic Script
parameter to denote use of the grab mechanic.infinity
ensures the Joint is unbreakable.VRTK/Examples/005_Controller_BasicObjectGrabbing
demonstrates this grab attach mechanic all of the grabbable objects in the scene.
extends VRTK_BaseJointGrabAttach
Attaches the grabbed Interactable Object to the grabbing object via a Spring Joint.
The Interactable Object will be attached to the grabbing object via a Spring Joint and the Joint can be broken upon colliding the Interactable Object with other colliders.
Script Usage:
VRTK_SpringJointGrabAttach
script on either:
Grab Attach Mechanic Script
parameter to denote use of the grab mechanic.infinity
ensures the Joint is unbreakable.VRTK/Examples/021_Controller_GrabbingObjectsWithJoints
demonstrates this grab attach mechanic on the Drawer object in the scene.
extends VRTK_BaseJointGrabAttach
Attaches the grabbed Interactable Object to the grabbing object via a custom Joint.
The Interactable Object will be attached to the grabbing object via a custom Joint and the Joint can be broken upon colliding the Interactable Object with other colliders.
Script Usage:
VRTK_CustomJointGrabAttach
script on either:
Grab Attach Mechanic Script
parameter to denote use of the grab mechanic.Joint
component suitable for attaching the grabbed Interactable Object to the grabbing object with and provide it to the Custom Joint
parameter.VRTK/Examples/021_Controller_GrabbingObjectsWithJoints
demonstrates this grab attach mechanic on the Lamp object in the scene.
extends VRTK_BaseGrabAttach
Sets the grabbed Interactable Object to be a child of the grabbing object.
The Interactable Object will have 1:1 tracking of the grabbing object, however it will also have reduced collision detection and will be able to pass through other colliders.
Script Usage:
VRTK_ChildOfControllerGrabAttach
script on either:
Grab Attach Mechanic Script
parameter to denote use of the grab mechanic.
public override bool StartGrab(GameObject grabbingObject, GameObject givenGrabbedObject, Rigidbody givenControllerAttachPoint)
GameObject grabbingObject
- The GameObject that is doing the grabbing.GameObject givenGrabbedObject
- The GameObject that is being grabbed.Rigidbody givenControllerAttachPoint
- The point on the grabbing object that the grabbed object should be attached to after grab occurs.bool
- Returns true
if the grab is successful, false
if the grab is unsuccessful.The StartGrab method sets up the grab attach mechanic as soon as an Interactable Object is grabbed. It is also responsible for creating the joint on the grabbed object.
public override void StopGrab(bool applyGrabbingObjectVelocity)
bool applyGrabbingObjectVelocity
- If true
will apply the current velocity of the grabbing object to the grabbed object on release.The StopGrab method ends the grab of the current Interactable Object and cleans up the state.
VRTK/Examples/023_Controller_ChildOfControllerOnGrab
uses this grab attach mechanic for the bow and the arrow.
extends VRTK_BaseGrabAttach
Applies velocity to the grabbed Interactable Object to ensure it tracks the position of the grabbing object.
The Interactable Object follows the grabbing object based on velocity being applied and therefore fully interacts with all other scene Colliders but not at a true 1:1 tracking.
Script Usage:
VRTK_TrackObjectGrabAttach
script on either:
Grab Attach Mechanic Script
parameter to denote use of the grab mechanic.
public override void StopGrab(bool applyGrabbingObjectVelocity)
bool applyGrabbingObjectVelocity
- If true
will apply the current velocity of the grabbing object to the grabbed Interactable Object on release.The StopGrab method ends the grab of the current Interactable Object and cleans up the state.
public override Transform CreateTrackPoint(Transform controllerPoint, GameObject currentGrabbedObject, GameObject currentGrabbingObject, ref bool customTrackPoint)
Transform controllerPoint
- The point on the controller where the grab was initiated.GameObject currentGrabbedObject
- The GameObject that is currently being grabbed.GameObject currentGrabbingObject
- The GameObject that is currently doing the grabbing.ref bool customTrackPoint
- A reference to whether the created track point is an auto generated custom object.Transform
- The Transform of the created track point.The CreateTrackPoint method sets up the point of grab to track on the grabbed object.
public override void ProcessUpdate()
The ProcessUpdate method is run in every Update method on the Interactable Object. It is responsible for checking if the tracked object has exceeded it's detach distance.
public override void ProcessFixedUpdate()
The ProcessFixedUpdate method is run in every FixedUpdate method on the Interactable Object. It applies velocity to the object to ensure it is tracking the grabbing object.
VRTK/Examples/021_Controller_GrabbingObjectsWithJoints
demonstrates this grab attach mechanic on the Chest handle and Fire Extinguisher body.
extends VRTK_TrackObjectGrabAttach
Applies a rotational force to the grabbed Interactable Object.
The Interactable Object is not attached to the grabbing object but rather has a rotational force applied based on the rotation of the grabbing object.
Script Usage:
VRTK_RotatorTrackGrabAttach
script on either:
Grab Attach Mechanic Script
parameter to denote use of the grab mechanic.
public override void StopGrab(bool applyGrabbingObjectVelocity)
bool applyGrabbingObjectVelocity
- If true
will apply the current velocity of the grabbing object to the grabbed Interactable Object on release.The StopGrab method ends the grab of the current Interactable Object and cleans up the state.
public override void ProcessFixedUpdate()
The ProcessFixedUpdate method is run in every FixedUpdate method on the Interactable Object. It applies a force to the grabbed Interactable Object to move it in the direction of the grabbing object.
VRTK/Examples/021_Controller_GrabbingObjectsWithJoints
demonstrates this grab attach mechanic on the Wheel and Door objects in the scene.
extends VRTK_BaseGrabAttach
Marks the Interactable Object as being climbable.
The Interactable Object will not be grabbed to the controller, instead in conjunction with the
VRTK_PlayerClimb
script will enable the PlayArea to be moved around as if it was climbing.
Script Usage:
VRTK_ClimbableGrabAttach
script on either:
Grab Attach Mechanic Script
parameter to denote use of the grab mechanic.VRTK/Examples/037_CameraRig_ClimbingFalling
uses this grab attach mechanic for each item that is climbable in the scene.
extends VRTK_BaseGrabAttach
Scrubs through the given animation based on the distance from the grabbing object to the original grabbing point.
Script Usage:
VRTK_ControlAnimationGrabAttach
script on either:
Grab Attach Mechanic Script
parameter to denote use of the grab mechanic.Animation Timeline
parameter takes a legacy Animation
component to use as the timeline to scrub through. The animation must be marked as legacy
via the inspector in debug mode.Animator Timeline
parameter takes an Animator component to use as the timeline to scrub through.Animator Timeline
will be ignored if it is also set.AnimationFrameAtStart
- Emitted when the Animation Frame is at the start.AnimationFrameAtEnd
- Emitted when the Animation Frame is at the end.AnimationFrameChanged
- Emitted when the Animation Frame has changed.Adding the VRTK_ControlAnimationGrabAttach_UnityEvents
component to VRTK_ControlAnimationGrabAttach
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.GameObject interactingObject
- The GameObject that is performing the interaction (e.g. a controller).float currentFrame
- The current frame the animation is on.
public override bool StartGrab(GameObject grabbingObject, GameObject givenGrabbedObject, Rigidbody givenControllerAttachPoint)
GameObject grabbingObject
- The GameObject that is doing the grabbing.GameObject givenGrabbedObject
- The GameObject that is being grabbed.Rigidbody givenControllerAttachPoint
- The point on the grabbing object that the grabbed object should be attached to after grab occurs.bool
- Returns true
if the grab is successful, false
if the grab is unsuccessful.The StartGrab method sets up the grab attach mechanic as soon as an Interactable Object is grabbed.
public override void StopGrab(bool applyGrabbingObjectVelocity)
bool applyGrabbingObjectVelocity
- If true
will apply the current velocity of the grabbing object to the grabbed object on release.The StopGrab method ends the grab of the current Interactable Object and cleans up the state.
public override Transform CreateTrackPoint(Transform controllerPoint, GameObject currentGrabbedObject, GameObject currentGrabbingObject, ref bool customTrackPoint)
Transform controllerPoint
- The point on the controller where the grab was initiated.GameObject currentGrabbedObject
- The GameObject that is currently being grabbed.GameObject currentGrabbingObject
- The GameObject that is currently doing the grabbing.ref bool customTrackPoint
- A reference to whether the created track point is an auto generated custom object.Transform
- The Transform of the created track point.The CreateTrackPoint method sets up the point of grab to track on the grabbed object.
public override void ProcessUpdate()
The ProcessUpdate method is run in every Update method on the Interactable Object.
public virtual void SetFrame(float frame)
float frame
- The frame to scrub to.The SetFrame method scrubs to the specific frame of the Animator timeline.
public virtual void RewindAnimation()
The RewindAnimation method will force the animation to rewind to the start frame.
extends VRTK_BaseGrabAttach
Moves the Transform of the Interactable Object towards the interacting object within specified limits.
To allow unrestricted movement, set the axis limit minimum to
-infinity
and the axis limit maximum toinfinity
.
Script Usage:
VRTK_MoveTransformGrabAttach
script on either:
Grab Attach Mechanic Script
parameter to denote use of the grab mechanic.Kinematic
when the grab occurs.Reset To Orign On Release Speed
is 0f
then the position will not be reset.public Vector3 localOrigin
- The default local position of the Interactable Object.TransformPositionChanged
- Emitted when the Transform position has changed.XAxisMinLimitReached
- Emitted when the Transform position has reached the X Axis Min Limit.XAxisMinLimitExited
- Emitted when the Transform position has exited the X Axis Min Limit.XAxisMaxLimitReached
- Emitted when the Transform position has reached the X Axis Max Limit.XAxisMaxLimitExited
- Emitted when the Transform position has exited the X Axis Max Limit.YAxisMinLimitReached
- Emitted when the Transform position has reached the Y Axis Min Limit.YAxisMinLimitExited
- Emitted when the Transform position has exited the Y Axis Min Limit.YAxisMaxLimitReached
- Emitted when the Transform position has reached the Y Axis Max Limit.YAxisMaxLimitExited
- Emitted when the Transform position has exited the Y Axis Max Limit.ZAxisMinLimitReached
- Emitted when the Transform position has reached the Z Axis Min Limit.ZAxisMinLimitExited
- Emitted when the Transform position has exited the Z Axis Min Limit.ZAxisMaxLimitReached
- Emitted when the Transform position has reached the Z Axis Max Limit.ZAxisMaxLimitExited
- Emitted when the Transform position has exited the Z Axis Max Limit.Adding the VRTK_MoveTransformGrabAttach_UnityEvents
component to VRTK_MoveTransformGrabAttach
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.GameObject interactingObject
- The GameObject that is performing the interaction (e.g. a controller).Vector3 position
- The current position in relation to the axis limits from the origin position.Vector3 normalizedPosition
- The normalized position (between 0f
and 1f
) of the Interactable Object in relation to the axis limits.Vector3 currentDirection
- The direction vector that the Interactable Object is currently moving across the axes in.Vector3 originDirection
- The direction vector that the Interactable Object is currently moving across the axes in in relation to the origin position.
public override bool StartGrab(GameObject grabbingObject, GameObject givenGrabbedObject, Rigidbody givenControllerAttachPoint)
GameObject grabbingObject
- The GameObject that is doing the grabbing.GameObject givenGrabbedObject
- The GameObject that is being grabbed.Rigidbody givenControllerAttachPoint
- The point on the grabbing object that the grabbed object should be attached to after grab occurs.bool
- Returns true
if the grab is successful, false
if the grab is unsuccessful.The StartGrab method sets up the grab attach mechanic as soon as an Interactable Object is grabbed.
public override void StopGrab(bool applyGrabbingObjectVelocity)
bool applyGrabbingObjectVelocity
- If true
will apply the current velocity of the grabbing object to the grabbed object on release.The StopGrab method ends the grab of the current Interactable Object and cleans up the state.
public override Transform CreateTrackPoint(Transform controllerPoint, GameObject currentGrabbedObject, GameObject currentGrabbingObject, ref bool customTrackPoint)
Transform controllerPoint
- The point on the controller where the grab was initiated.GameObject currentGrabbedObject
- The GameObject that is currently being grabbed.GameObject currentGrabbingObject
- The GameObject that is currently doing the grabbing.ref bool customTrackPoint
- A reference to whether the created track point is an auto generated custom object.Transform
- The Transform of the created track point.The CreateTrackPoint method sets up the point of grab to track on the grabbed object.
public override void ProcessUpdate()
The ProcessUpdate method is run in every Update method on the Interactable Object.
public virtual Vector3 GetPosition()
Vector3
- A Vector3 containing the current Transform position in relation to the axis limits.The GetPosition method returns a Vector3 of the Transform position in relation to the axis limits.
public virtual Vector3 GetNormalizedPosition()
Vector3
- A normalized Vector3 of the Transform position in relation to the axis limits.The GetNormalizedPosition method returns a Vector3 of the Transform position normalized between 0f
and 1f
in relation to the axis limits.;
public virtual Vector3 GetCurrentDirection()
Vector3
- A Vector3 of the direction the Transform is moving across the relevant axis in.The GetCurrentDirection method returns a Vector3 of the current positive/negative axis direction that the Transform is moving in.
public virtual Vector3 GetDirectionFromOrigin()
Vector3
- A Vector3 of the direction the Transform is moving across the relevant axis in relation to the original position.The GetDirectionFromOrigin method returns a Vector3 of the direction across the axis from the original position.
public virtual void SetCurrentPosition(Vector3 newPosition, float speed)
Vector3 newPosition
- The position to move the Interactable Object to.float speed
- The speed in which to move the Interactable Object.The SetCurrentPosition method sets the position of the Interactable Object to the given new position at the appropriate speed.
public virtual void ResetPosition()
The ResetPosition method will move the Interactable Object back to the origin position.
public virtual Limits2D[] GetWorldLimits()
Limits2D[]
- An array of axis limits in world space.The GetWorldLimits method returns an array of minimum and maximum axis limits for the Interactable Object in world space.
extends VRTK_BaseGrabAttach
Rotates the Transform of the Interactable Object around a specified transform local axis within the given limits.
To allow unrestricted movement, set the angle limits minimum to
-infinity
and the angle limits maximum toinfinity
.
Script Usage:
VRTK_RotateTransformGrabAttach
script on either:
Grab Attach Mechanic Script
parameter to denote use of the grab mechanic.Origin Deadzone
distance then it will be automatically ungrabbed.Reset To Orign On Release Speed
is 0f
then the rotation will not be reset.public enum RotationAxis
- The local axis for rotation.
xAxis
- The local X Axis of the transform.yAxis
- The local Y Axis of the transform.zAxis
- The local Z Axis of the transform.public enum RotationType
- The way in which rotation from the grabbing object is applied.
FollowAttachPoint
- The angle between the Interactable Object origin and the grabbing object attach point.FollowLongitudinalAxis
- The angular velocity across the grabbing object's longitudinal axis (the roll axis).FollowLateralAxis
- The angular velocity across the grabbing object's lateral axis (the pitch axis).FollowPerpendicularAxis
- The angular velocity across the grabbing object's perpendicular axis (the yaw axis).public Quaternion originRotation
- The default local rotation of the Interactable Object.AngleChanged
- Emitted when the angle changes.MinAngleReached
- Emitted when the angle reaches the minimum angle.MinAngleExited
- Emitted when the angle exits the minimum angle state.MaxAngleReached
- Emitted when the angle reaches the maximum angle.MaxAngleExited
- Emitted when the angle exits the maximum angle state.Adding the VRTK_RotateTransformGrabAttach_UnityEvents
component to VRTK_RotateTransformGrabAttach
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.GameObject interactingObject
- The GameObject that is performing the interaction (e.g. a controller).float currentAngle
- The current angle the Interactable Object is rotated to.float normalizedAngle
- The normalized angle (between 0f
and 1f
) the Interactable Object is rotated to.Vector3 rotationSpeed
- The speed in which the rotation is occuring.
public override bool StartGrab(GameObject grabbingObject, GameObject givenGrabbedObject, Rigidbody givenControllerAttachPoint)
GameObject grabbingObject
- The GameObject that is doing the grabbing.GameObject givenGrabbedObject
- The GameObject that is being grabbed.Rigidbody givenControllerAttachPoint
- The point on the grabbing object that the grabbed object should be attached to after grab occurs.bool
- Returns true
if the grab is successful, false
if the grab is unsuccessful.The StartGrab method sets up the grab attach mechanic as soon as an Interactable Object is grabbed.
public override void StopGrab(bool applyGrabbingObjectVelocity)
bool applyGrabbingObjectVelocity
- If true
will apply the current velocity of the grabbing object to the grabbed object on release.The StopGrab method ends the grab of the current Interactable Object and cleans up the state.
public override void ProcessUpdate()
The ProcessUpdate method is run in every Update method on the Interactable Object.
public virtual void SetRotation(float newAngle, float transitionTime = 0f)
float newAngle
- The angle to rotate to through the current rotation axis.float transitionTime
- The time in which the entire rotation operation will take place.The SetRotation method sets the rotation on the Interactable Object to the given angle over the desired time.
public virtual void ResetRotation(bool ignoreTransition = false)
bool ignoreTransition
- If this is true
then the Reset To Origin On Release Speed
will be ignored and the reset will occur instantly.The ResetRotation method will rotate the Interactable Object back to the origin rotation.
public virtual float GetAngle()
float
- The current rotated angle.The GetAngle method returns the current angle the Interactable Object is rotated to.
public virtual float GetNormalizedAngle()
float
- The normalized rotated angle. Will return 0f
if either limit is set to infinity
.The GetNormalizedAngle returns the normalized current angle between the minimum and maximum angle limits.
public virtual Vector3 GetRotationSpeed()
Vector3
- A Vector3 containing the speed each axis is rotating in.The GetRotationSpeed returns the current speed in which the Interactable Object is rotating.
A collection of scripts that are used to provide different actions when a secondary controller grabs a grabbed object.
Provides a base that all secondary controller grab attach can inherit from.
Script Usage:
This is an abstract class that is to be inherited to a concrete class that provides secondary controller grab action functionality, therefore this script should not be directly used.
public virtual void Initialise(VRTK_InteractableObject currentGrabbdObject, VRTK_InteractGrab currentPrimaryGrabbingObject, VRTK_InteractGrab currentSecondaryGrabbingObject, Transform primaryGrabPoint, Transform secondaryGrabPoint)
VRTK_InteractableObject currentGrabbdObject
- The Interactable Object script for the object currently being grabbed by the primary grabbing object.VRTK_InteractGrab currentPrimaryGrabbingObject
- The Interact Grab script for the object that is associated with the primary grabbing object.VRTK_InteractGrab currentSecondaryGrabbingObject
- The Interact Grab script for the object that is associated with the secondary grabbing object.Transform primaryGrabPoint
- The point on the Interactable Object where the primary Interact Grab initially grabbed the Interactable Object.Transform secondaryGrabPoint
- The point on the Interactable Object where the secondary Interact Grab initially grabbed the Interactable Object.The Initalise method is used to set up the state of the secondary action when the Interactable Object is initially grabbed by a secondary Interact Grab.
public virtual void ResetAction()
The ResetAction method is used to reset the secondary action when the Interactable Object is no longer grabbed by a secondary Interact Grab.
public virtual bool IsActionable()
bool
- Returns true
if the secondary grab action does perform an action on secondary grab.The IsActionable method is used to determine if the secondary grab action performs an action on grab.
public virtual bool IsSwappable()
bool
- Returns true
if the grab action allows swapping to another grabbing object.The IsSwappable method is used to determine if the secondary grab action allows to swab the grab state to another grabbing Interactable Object.
public virtual void ProcessUpdate()
The ProcessUpdate method runs in every Update on the Interactable Object whilst it is being grabbed by a secondary Interact Grab.
public virtual void ProcessFixedUpdate()
The ProcessFixedUpdate method runs in every FixedUpdate on the Interactable Object whilst it is being grabbed by a secondary Interact Grab.
public virtual void OnDropAction()
The OnDropAction method is executed when the current grabbed Interactable Object is dropped and can be used up to clean up any secondary grab actions.
extends VRTK_BaseGrabAction
Swaps the grabbed Interactable Object to the new grabbing object.
Script Usage:
VRTK_SwapControllerGrabAction
script on either:
Secondary Grab Action Script
parameter to denote use of the secondary grab action.VRTK/Examples/005_Controller_BasicObjectGrabbing
demonstrates the ability to swap objects between controllers on grab.
extends VRTK_BaseGrabAction
Scales the grabbed Interactable Object along the given axes based on the position of the secondary grabbing Interact Grab.
Script Usage:
VRTK_AxisScaleGrabAction
script on either:
Secondary Grab Action Script
parameter to denote use of the secondary grab action.
public override void Initialise(VRTK_InteractableObject currentGrabbdObject, VRTK_InteractGrab currentPrimaryGrabbingObject, VRTK_InteractGrab currentSecondaryGrabbingObject, Transform primaryGrabPoint, Transform secondaryGrabPoint)
VRTK_InteractableObject currentGrabbdObject
- The Interactable Object script for the object currently being grabbed by the primary grabbing object.VRTK_InteractGrab currentPrimaryGrabbingObject
- The Interact Grab script for the object that is associated with the primary grabbing object.VRTK_InteractGrab currentSecondaryGrabbingObject
- The Interact Grab script for the object that is associated with the secondary grabbing object.Transform primaryGrabPoint
- The point on the Interactable Object where the primary Interact Grab initially grabbed the Interactable Object.Transform secondaryGrabPoint
- The point on the Interactable Object where the secondary Interact Grab initially grabbed the Interactable Object.The Initalise method is used to set up the state of the secondary action when the Interactable Object is initially grabbed by a secondary Interact Grab.
public override void ProcessUpdate()
The ProcessUpdate method runs in every Update on the Interactable Object whilst it is being grabbed by a secondary Interact Grab.
public override void ProcessFixedUpdate()
The ProcessFixedUpdate method runs in every FixedUpdate on the Interactable Object whilst it is being grabbed by a secondary Interact Grab and performs the scaling action.
VRTK/Examples/043_Controller_SecondaryControllerActions
demonstrates the ability to grab an object with one controller and scale it by grabbing and pulling with the second controller.
extends VRTK_BaseGrabAction
Controls the facing direction of the grabbed Interactable Object to rotate in the direction of the secondary grabbing object.
Rotation will only occur correctly if the Interactable Object
forward
is correctly aligned to the worldz-axis
and theup
is correctly aligned to the worldy-axis
. It is also not possible to control the direction of an Interactable Object that uses the Joint based grab mechanics.
Script Usage:
VRTK_ControlDirectionGrabAction
script on either:
Secondary Grab Action Script
parameter to denote use of the secondary grab action.0
for instant snap, infinity
for no snap back.
public override void Initialise(VRTK_InteractableObject currentGrabbdObject, VRTK_InteractGrab currentPrimaryGrabbingObject, VRTK_InteractGrab currentSecondaryGrabbingObject, Transform primaryGrabPoint, Transform secondaryGrabPoint)
VRTK_InteractableObject currentGrabbdObject
- The Interactable Object script for the object currently being grabbed by the primary grabbing object.VRTK_InteractGrab currentPrimaryGrabbingObject
- The Interact Grab script for the object that is associated with the primary grabbing object.VRTK_InteractGrab currentSecondaryGrabbingObject
- The Interact Grab script for the object that is associated with the secondary grabbing object.Transform primaryGrabPoint
- The point on the Interactable Object where the primary Interact Grab initially grabbed the Interactable Object.Transform secondaryGrabPoint
- The point on the Interactable Object where the secondary Interact Grab initially grabbed the Interactable Object.The Initalise method is used to set up the state of the secondary action when the object is initially grabbed by a secondary controller.
public override void ResetAction()
The ResetAction method is used to reset the secondary action when the Interactable Object is no longer grabbed by a secondary Interact Grab.
public override void OnDropAction()
The OnDropAction method is executed when the current grabbed Interactable Object is dropped and can be used up to clean up any secondary grab actions.
public override void ProcessUpdate()
The ProcessUpdate method runs in every Update on the Interactable Object whilst it is being grabbed by a secondary Interact Grab.
public override void ProcessFixedUpdate()
The ProcessFixedUpdate method runs in every FixedUpdate on the Interactable Object whilst it is being grabbed by a secondary Interact Grab and influences the rotation of the Interactable Object.
VRTK/Examples/043_Controller_SecondaryControllerActions
demonstrates the ability to grab an object with one controller and control their direction with the second controller.
Contains scripts that form the basis of interactable 3D controls that are either Physics based or artificially simulated.
Provides a base that all Controllables can inherit from.
Script Usage:
This is an abstract class that is to be inherited to a concrete class that provides controllable functionality, therefore this script should not be directly used.
public enum OperatingAxis
- The local axis that the Controllable will be operated through.
xAxis
- The local x axis.yAxis
- The local y axis.zAxis
- The local z axis.ValueChanged
- Emitted when the Controllable value has changed.RestingPointReached
- Emitted when the Controllable value has reached the resting point.MinLimitReached
- Emitted when the Controllable value has reached the minimum limit.MinLimitExited
- Emitted when the Controllable value has exited the minimum limit.MaxLimitReached
- Emitted when the Controllable value has reached the maximum limit.MaxLimitExited
- Emitted when the Controllable value has exited the maximum limit.Adding the VRTK_BaseControllable_UnityEvents
component to VRTK_BaseControllable
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.Collider interactingCollider
- The Collider that is initiating the interaction.VRTK_InteractTouch interactingTouchScript
- The optional Interact Touch script that is initiating the interaction.float value
- The current value being reported by the controllable.float normalizedValue
- The normalized value being reported by the controllable.
public virtual bool AtMinLimit()
bool
- Returns true
if the Controllable is at it's minimum limit.The AtMinLimit method returns whether the Controllable is currently at it's minimum limit.
public virtual bool AtMaxLimit()
bool
- Returns true
if the Controllable is at it's maximum limit.The AtMaxLimit method returns whether the Controllable is currently at it's maximum limit.
public virtual Vector3 GetOriginalLocalPosition()
Vector3
- A Vector3 of the original local position.The GetOriginalLocalPosition method returns the original local position of the control.
public virtual Quaternion GetOriginalLocalRotation()
Quaternion
- A quaternion of the original local rotation.The GetOriginalLocalRotation method returns the original local rotation of the control.
public virtual Collider[] GetControlColliders()
Collider[]
- The Colliders array associated with the control.The GetControlColliders method returns the Colliders array associated with the control.
public virtual Collider GetInteractingCollider()
Collider
- The Collider currently interacting with the control.The GetInteractingCollider method returns the Collider of the GameObject currently interacting with the control.
public virtual VRTK_InteractTouch GetInteractingTouch()
VRTK_InteractTouch
- The Interact Touch script currently interacting with the control.The GetInteractingTouch method returns the Interact Touch script of the GameObject currently interacting with the control.
A collection of scripts that provide physics based controls that mimiic real life objects.
extends VRTK_BaseControllable
Provides a base that all physics based Controllables can inherit from.
Script Usage:
This is an abstract class that is to be inherited to a concrete class that provides physics based controllable functionality, therefore this script should not be directly used.
public virtual Rigidbody GetControlRigidbody()
Rigidbody
- The Rigidbody associated with the control.The GetControlRigidbody method returns the rigidbody associated with the control.
public virtual GameObject GetControlActivatorContainer()
GameObject
- The GameObject that contains the Controller Rigidbody Activator associated with the control.The GetControlActivatorContainer method returns the GameObject that contains the Controller Rigidbody Activator associated with the control.
extends VRTK_BasePhysicsControllable
A physics based pushable pusher.
Required Components:
Collider
- A Unity Collider to determine when an interaction has occured. Can be a compound collider set in child GameObjects. Will be automatically added at runtime.Rigidbody
- A Unity Rigidbody to allow the GameObject to be affected by the Unity Physics System. Will be automatically added at runtime.Optional Components:
VRTK_ControllerRigidbodyActivator
- A Controller Rigidbody Activator to automatically enable the controller rigidbody upon touching the pusher.Script Usage:
VRTK_PhysicsPusher
script onto the GameObject that is to become the pusher.The Physics Pusher script must not be on a root level GameObject. Any runtime world positioning of the pusher must be set on the parent container GameObject.
Operate Axis
until the pusher reaches the pressed position.Operate Axis
has to be within the minimum and maximum limits of the pusher.Resting Position
before the pusher is considered to be resting when not being interacted with.0f
will set the pusher position to the original position, 1f
will set the pusher position to the pressed position.
public override float GetValue()
float
- The actual position of the pusher.The GetValue method returns the current position value of the pusher.
public override float GetNormalizedValue()
float
- The normalized position of the pusher.The GetNormalizedValue method returns the current position value of the pusher normalized between 0f
and 1f
.
public override void SetValue(float value)
float value
- Not used.The SetValue method is not implemented as the pusher resets automatically.
public override bool IsResting()
bool
- Returns true
if the pusher is currently at the resting position.The IsResting method returns whether the pusher is currently at it's resting position.
public virtual ConfigurableJoint GetControlJoint()
ConfigurableJoint
- The joint associated with the control.The GetControlJoint method returns the joint associated with the control.
extends VRTK_BasePhysicsControllable
A physics based rotatable object.
Required Components:
Collider
- A Unity Collider to determine when an interaction has occured. Can be a compound collider set in child GameObjects. Will be automatically added at runtime.Rigidbody
- A Unity Rigidbody to allow the GameObject to be affected by the Unity Physics System. Will be automatically added at runtime.Optional Components:
VRTK_ControllerRigidbodyActivator
- A Controller Rigidbody Activator to automatically enable the controller rigidbody when near the rotator.Script Usage:
VRTK_PhysicsRotator
script onto the GameObject that is to become the rotatable object and ensure the Transform rotation is 0, 0, 0
.Hinge Point
parameter on the Physics Rotator script.The rotator GameObject must not be at the root level and needs to have the Transform rotation set to
0,0,0
. This is the reason for the container GameObject requirement. Any positioning of the rotator must be set on the parent container GameObject.
Resting Angle
that the current angle of the rotator needs to be within to snap the rotator back to the Resting Angle
.Operate Axis
.Step Value Range
.Operate Axis
Grabbed Friction
value will be used as the Rigidbody drag value when the rotator is grabbed and the Released Friction
value will be used as the Rigidbody drag value when the door is released.public enum GrabMechanic
- Type of Grab Mechanic
TrackObject
- The Track Object Grab MechanicRotatorTrack
- The Rotator Track Grab Mechanic
public override float GetValue()
float
- The actual rotation of the rotator.The GetValue method returns the current rotation value of the rotator.
public override float GetNormalizedValue()
float
- The normalized rotation of the rotator.The GetNormalizedValue method returns the current rotation value of the rotator normalized between 0f
and 1f
.
public override void SetValue(float value)
float value
- The new rotation valueThe SetValue method sets the current Angle of the rotator
public virtual float GetStepValue(float currentValue)
float currentValue
- The current angle value of the rotator to get the Step Value for.float
- The current Step Value based on the rotator angle.The GetStepValue method returns the current angle of the rotator based on the step value range.
public virtual void SetAngleTargetWithStepValue(float givenStepValue)
float givenStepValue
- The step value within the Step Value Range
to set the Angle Target
parameter to.The SetAngleTargetWithStepValue sets the Angle Target
parameter but uses a value within the Step Value Range
.
public virtual void SetRestingAngleWithStepValue(float givenStepValue)
float givenStepValue
- The step value within the Step Value Range
to set the Resting Angle
parameter to.The SetRestingAngleWithStepValue sets the Resting Angle
parameter but uses a value within the Step Value Range
.
public virtual float GetAngleFromStepValue(float givenStepValue)
float givenStepValue
- The step value to check the angle for.float
- The angle the rotator would be at based on the given step value.The GetAngleFromStepValue returns the angle the rotator would be at based on the given step value.
public override bool IsResting()
bool
- Returns true
if the rotator is at the resting angle or within the resting angle threshold.The IsResting method returns whether the rotator is at the resting angle or within the resting angle threshold.
public virtual HingeJoint GetControlJoint()
HingeJoint
- The joint associated with the control.The GetControlJoint method returns the joint associated with the control.
public virtual VRTK_InteractableObject GetControlInteractableObject()
VRTK_InteractableObject
- The Interactable Object associated with the control.The GetControlInteractableObject method returns the Interactable Object associated with the control.
extends VRTK_BasePhysicsControllable
A physics based slider.
Required Components:
Collider
- A Unity Collider to determine when an interaction has occured. Can be a compound collider set in child GameObjects. Will be automatically added at runtime.Rigidbody
- A Unity Rigidbody to allow the GameObject to be affected by the Unity Physics System. Will be automatically added at runtime.Optional Components:
VRTK_ControllerRigidbodyActivator
- A Controller Rigidbody Activator to automatically enable the controller rigidbody when near the slider.Script Usage:
VRTK_PhysicsSlider
script onto the GameObject that is to become the slider.The slider GameObject must not be at the root level and needs to have it's Transform position set to
0,0,0
. This is the reason for the container GameObject requirement. Any positioning of the slider must be set on the parent GameObject.
Operate Axis
. A negative value will allow it to move the opposite way.0f
(start point) to 1f
(end point).0f
(start point) to 1f
(end point).Resting Position
before the slider is forced back to the Resting Position
if it is not grabbed.Operate Axis
.Step Value Range
.Operate Axis
public override float GetValue()
float
- The actual position of the button.The GetValue method returns the current position value of the slider.
public override float GetNormalizedValue()
float
- The normalized position of the button.The GetNormalizedValue method returns the current position value of the slider normalized between 0f
and 1f
.
public override void SetValue(float value)
float value
- The new position valueThe SetValue method sets the current position value of the slider
public virtual float GetStepValue(float currentValue)
float currentValue
- The current position value of the slider to get the Step Value for.float
- The current Step Value based on the slider position.The GetStepValue method returns the current position of the slider based on the step value range.
public virtual void SetPositionTargetWithStepValue(float givenStepValue)
float givenStepValue
- The step value within the Step Value Range
to set the Position Target
parameter to.The SetTargetPositionWithStepValue sets the Position Target
parameter but uses a value within the Step Value Range
.
public virtual void SetRestingPositionWithStepValue(float givenStepValue)
float givenStepValue
- The step value within the Step Value Range
to set the Resting Position
parameter to.The SetRestingPositionWithStepValue sets the Resting Position
parameter but uses a value within the Step Value Range
.
public virtual float GetPositionFromStepValue(float givenStepValue)
float givenStepValue
- The step value to check the position for.float
- The position the slider would be at based on the given step value.The GetPositionFromStepValue returns the position the slider would be at based on the given step value.
public override bool IsResting()
bool
- Returns true
if the slider is at the resting position or within the resting position threshold.The IsResting method returns whether the slider is currently in a resting state at the resting position or within the resting position threshold and not grabbed.
public virtual ConfigurableJoint GetControlJoint()
ConfigurableJoint
- The joint associated with the control.The GetControlJoint method returns the joint associated with the control.
public virtual VRTK_InteractableObject GetControlInteractableObject()
VRTK_InteractableObject
- The Interactable Object associated with the control.The GetControlInteractableObject method returns the Interactable Object associated with the control.
A collection of scripts that provide artificial simulated controls that mimiic real life objects.
extends VRTK_BaseControllable
An artificially simulated pushable pusher.
Required Components:
Collider
- A Unity Collider to determine when an interaction has occured. Can be a compound collider set in child GameObjects. Will be automatically added at runtime.Script Usage:
VRTK_ArtificialPusher
script onto the GameObject that is to become the pusher.Operate Axis
until the pusher reaches the pressed position.Operate Axis
has to be within the minimum and maximum limits of the pusher.Resting Position
before the pusher is considered to be resting when not being interacted with.Pressed Distance
position.Target Position
of the pusher.
public override float GetValue()
float
- The actual position of the pusher.The GetValue method returns the current position value of the pusher.
public override float GetNormalizedValue()
float
- The normalized position of the pusher.The GetNormalizedValue method returns the current position value of the pusher normalized between 0f
and 1f
.
public override void SetValue(float value)
float value
- Not used.The SetValue method is not implemented as the pusher resets automatically.
public override bool IsResting()
bool
- Returns true
if the pusher is currently at the resting position.The IsResting method returns whether the pusher is currently at it's resting position.
public virtual void SetStayPressed(bool state)
bool state
- The state to set the Stay Pressed
parameter to.The SetStayPressed method sets the Stay Pressed
parameter to the given state and if the state is false and the pusher is currently pressed then it is reset to the original position.
public virtual void SetPositionTarget(float normalizedTarget)
float normalizedTarget
- The Position Target
to set the pusher to between 0f
and 1f
.The SetPositionTarget method sets the Position Target
parameter to the given normalized value.
extends VRTK_BaseControllable
A artificially simulated openable rotator.
Required Components:
Collider
- A Unity Collider to determine when an interaction has occured. Can be a compound collider set in child GameObjects. Will be automatically added at runtime.Script Usage:
VRTK_ArtificialRotator
script onto the GameObject that is to become the rotatable object and ensure the Transform rotation is 0, 0, 0
.Hinge Point
parameter on the Artificial Rotator script.The rotator GameObject must not be at the root level and needs to have the Transform rotation set to
0,0,0
. This is the reason for the container GameObject requirement. Any positioning of the rotator must be set on the parent container GameObject. The Artificial Rotator script GameObject will become the child of a runtime created GameObject that determines the rotational offset for the rotator.
Resting Angle
that the current angle of the rotator needs to be within to snap the rotator back to the Resting Angle
.Operate Axis
.Step Value Range
.Operate Axis
public override float GetValue()
float
- The actual rotation of the rotator.The GetValue method returns the current rotation value of the rotator.
public override float GetNormalizedValue()
float
- The normalized rotation of the rotator.The GetNormalizedValue method returns the current rotation value of the rotator normalized between 0f
and 1f
.
public override void SetValue(float value)
float value
- The new rotation valueThe SetValue method sets the current Angle of the rotator
public virtual GameObject GetContainer()
GameObject
- The GameObject container of the rotator control.The GetContainer method returns the GameObject that is generated to hold the rotator control.
public virtual float GetStepValue(float currentValue)
float currentValue
- The current angle value of the rotator to get the Step Value for.float
- The current Step Value based on the rotator angle.The GetStepValue method returns the current angle of the rotator based on the step value range.
public virtual void SetAngleTargetWithStepValue(float givenStepValue)
float givenStepValue
- The step value within the Step Value Range
to set the Angle Target
parameter to.The SetAngleTargetWithStepValue sets the Angle Target
parameter but uses a value within the Step Value Range
.
public virtual void SetRestingAngleWithStepValue(float givenStepValue)
float givenStepValue
- The step value within the Step Value Range
to set the Resting Angle
parameter to.The SetRestingAngleWithStepValue sets the Resting Angle
parameter but uses a value within the Step Value Range
.
public virtual float GetAngleFromStepValue(float givenStepValue)
float givenStepValue
- The step value to check the angle for.float
- The angle the rotator would be at based on the given step value.The GetAngleFromStepValue returns the angle the rotator would be at based on the given step value.
public virtual void SetAngleTarget(float newAngle)
float newAngle
- The angle in which to rotate the rotator to.The SetAngleTarget method sets a target angle to rotate the rotator to.
public override bool IsResting()
bool
- Returns true
if the rotator is at the resting angle or within the resting angle threshold.The IsResting method returns whether the rotator is at the resting angle or within the resting angle threshold.
public virtual VRTK_InteractableObject GetControlInteractableObject()
VRTK_InteractableObject
- The Interactable Object associated with the control.The GetControlInteractableObject method returns the Interactable Object associated with the control.
extends VRTK_BaseControllable
A artificially simulated slider.
Required Components:
Collider
- A Unity Collider to determine when an interaction has occured. Can be a compound collider set in child GameObjects. Will be automatically added at runtime.Script Usage:
VRTK_ArtificialSlider
script onto the GameObject that is to become the slider.The slider GameObject must not be at the root level and needs to have it's Transform position set to
0,0,0
. This is the reason for the container GameObject requirement. Any positioning of the slider must be set on the parent GameObject.
Operate Axis
. A negative value will allow it to move the opposite way.0f
(start point) to 1f
(end point).Resting Position
before the slider is forced back to the Resting Position
if it is not grabbed.Operate Axis
.Step Value Range
.Operate Axis
public override float GetValue()
float
- The actual position of the button.The GetValue method returns the current position value of the slider.
public override float GetNormalizedValue()
float
- The normalized position of the button.The GetNormalizedValue method returns the current position value of the slider normalized between 0f
and 1f
.
public override void SetValue(float value)
float value
- The new position valueThe SetValue method sets the current position value of the slider
public virtual float GetStepValue(float currentValue)
float currentValue
- The current position value of the slider to get the Step Value for.float
- The current Step Value based on the slider position.The GetStepValue method returns the current position of the slider based on the step value range.
public virtual void SetPositionTarget(float newPositionTarget, float speed)
float newPositionTarget
- The new position target value.float speed
- The speed to move to the new position target.The SetPositionTarget method allows the setting of the Position Target
parameter at runtime.
public virtual void SetPositionTargetWithStepValue(float givenStepValue, float speed)
float givenStepValue
- The step value within the Step Value Range
to set the Position Target
parameter to.float speed
- The speed to move to the new position target.The SetPositionTargetWithStepValue sets the Position Target
parameter but uses a value within the Step Value Range
.
public virtual void SetRestingPositionWithStepValue(float givenStepValue)
float givenStepValue
- The step value within the Step Value Range
to set the Resting Position
parameter to.The SetRestingPositionWithStepValue sets the Resting Position
parameter but uses a value within the Step Value Range
.
public virtual float GetPositionFromStepValue(float givenStepValue)
float givenStepValue
- The step value to check the position for.float
- The position the slider would be at based on the given step value.The GetPositionFromStepValue returns the position the slider would be at based on the given step value.
public override bool IsResting()
bool
- Returns true
if the slider is at the resting position or within the resting position threshold.The IsResting method returns whether the slider is at the resting position or within the resting position threshold.
public virtual VRTK_InteractableObject GetControlInteractableObject()
VRTK_InteractableObject
- The Interactable Object associated with the control.The GetControlInteractableObject method returns the Interactable Object associated with the control.
A collection of scripts that provide the ability to deal with tracking the world around the user in the scene.
Denotes when the HMD is colliding with valid geometry.
Script Usage:
VRTK_HeadsetCollision
script on any active scene GameObject.Is Trigger = true
.public bool headsetColliding
- Determines if the headset is currently colliding with another object. Default: false
public Collider collidingWith
- Stores the collider of what the headset is colliding with. Default: null
HeadsetCollisionDetect
- Emitted when the user's headset collides with another game object.HeadsetCollisionEnded
- Emitted when the user's headset stops colliding with a game object.Adding the VRTK_HeadsetCollision_UnityEvents
component to VRTK_HeadsetCollision
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.Collider collider
- The Collider of the game object the headset has collided with.Transform currentTransform
- The current Transform of the object that the Headset Collision Fade script is attached to (Camera).
public virtual bool IsColliding()
bool
- Returns true
if the headset is currently colliding with a valid game object.The IsColliding method is used to determine if the headset is currently colliding with a valid game object and returns true if it is and false if it is not colliding with anything or an invalid game object.
public virtual GameObject GetHeadsetColliderContainer()
GameObject
- The auto generated headset collider GameObject.The GetHeadsetColliderContainer method returns the auto generated GameObject that contains the headset collider.
VRTK/Examples/011_Camera_HeadSetCollisionFading
has collidable walls around the play area and if the user puts their head into any of the walls then the headset will fade to black.
Provides the ability to change the colour of the headset view to a specified colour over a given duration.
Script Usage:
VRTK_HeadsetFade
script on any active scene GameObject.HeadsetFadeStart
- Emitted when the user's headset begins to fade to a given colour.HeadsetFadeComplete
- Emitted when the user's headset has completed the fade and is now fully at the given colour.HeadsetUnfadeStart
- Emitted when the user's headset begins to unfade back to a transparent colour.HeadsetUnfadeComplete
- Emitted when the user's headset has completed unfading and is now fully transparent again.Adding the VRTK_HeadsetFade_UnityEvents
component to VRTK_HeadsetFade
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.float timeTillComplete
- A float that is the duration for the fade/unfade process has remaining.Transform currentTransform
- The current Transform of the object that the Headset Fade script is attached to (Camera).
public virtual bool IsFaded()
bool
- Returns true
if the headset is currently fading or faded.The IsFaded method returns true if the headset is currently fading or has completely faded and returns false if it is completely unfaded.
public virtual bool IsTransitioning()
bool
- Returns true
if the headset is currently in the process of fading or unfading.The IsTransitioning method returns true if the headset is currently fading or unfading and returns false if it is completely faded or unfaded.
public virtual void Fade(Color color, float duration)
Color color
- The colour to fade the headset view to.float duration
- The time in seconds to take to complete the fade transition.The Fade method initiates a change in the colour of the headset view to the given colour over a given duration.
public virtual void Unfade(float duration)
float duration
- The time in seconds to take to complete the unfade transition.The Unfade method initiates the headset to change colour back to a transparent colour over a given duration.
VRTK/Examples/011_Camera_HeadSetCollisionFading
has collidable walls around the play area and if the user puts their head into any of the walls then the headset will fade to black.
Initiates a fade of the headset view when a headset collision event is detected.
Required Components:
VRTK_HeadsetCollision
- A Headset Collision script to determine when the HMD has collided with valid geometry.VRTK_HeadsetFade
- A Headset Fade script to alter the visible colour on the HMD view.Script Usage:
VRTK_HeadsetCollisionFade
script on any active scene GameObject.VRTK/Examples/011_Camera_HeadSetCollisionFading
has collidable walls around the play area and if the user puts their head into any of the walls then the headset will fade to black.
Determines whether the HMD is in line of sight to the controllers or if the headset is directly looking at one of the controllers.
Script Usage:
VRTK_HeadsetControllerAware
script on any active scene GameObject.ControllerObscured
- Emitted when the controller is obscured by another object.ControllerUnobscured
- Emitted when the controller is no longer obscured by an object.ControllerGlanceEnter
- Emitted when the controller is seen by the headset view.ControllerGlanceExit
- Emitted when the controller is no longer seen by the headset view.Adding the VRTK_HeadsetControllerAware_UnityEvents
component to VRTK_HeadsetControllerAware
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.RaycastHit raycastHit
- The Raycast Hit struct of item that is obscuring the path to the controller.VRTK_ControllerReference controllerReference
- The reference to the controller that is being or has been obscured or being or has been glanced.
public virtual bool LeftControllerObscured()
bool
- Returns true
if the path between the headset and the controller is obscured.The LeftControllerObscured method returns the state of if the left controller is being obscured from the path of the headset.
public virtual bool RightControllerObscured()
bool
- Returns true
if the path between the headset and the controller is obscured.The RightControllerObscured method returns the state of if the right controller is being obscured from the path of the headset.
public virtual bool LeftControllerGlanced()
bool
- Returns true
if the headset can currently see the controller within the given radius threshold.the LeftControllerGlanced method returns the state of if the headset is currently looking at the left controller or not.
public virtual bool RightControllerGlanced()
bool
- Returns true
if the headset can currently see the controller within the given radius threshold.the RightControllerGlanced method returns the state of if the headset is currently looking at the right controller or not.
VRTK/Examples/029_Controller_Tooltips
displays tooltips that have been added to the controllers and are only visible when the controller is being looked at.
Attempts to provide the relative position of a hip without the need for additional hardware sensors.
Script Usage:
VRTK_HipTracking
script on any active scene GameObject and this GameObject will then track to the estimated hip position.extends VRTK_DestinationMarker
Allows the play area to be affected by physics and detect collisions with other valid geometry.
Optional Components:
VRTK_BasicTeleport
- A Teleporter script to use when snapping the play area to the nearest floor when releasing from grab.Script Usage:
VRTK_BodyPhysics
script on any active scene GameObject.y
distance between the headset and the object being leaned over, if object being leaned over is taller than this threshold then the current standing position won't be updated.y
distance between the floor and the headset exceeds this distance and Enable Body Collisions
is true then the rigidbody gravity will be used instead of teleport to drop to nearest floor.y
distance between the floor and the headset that must change before a fade transition is initiated. If the new user location is at a higher distance than the threshold then the headset blink transition will activate on teleport. If the new user location is within the threshold then no blink transition will happen, which is useful for walking up slopes, meshes and terrains to prevent constant blinking.y
position needs to change by between the current floor y
position and the previous floor y
position before a change in floor height is considered to have occurred. A higher value here will mean that a Drop To Floor
will be less likely to happen if the y
of the floor beneath the user hasn't changed as much as the given threshold.public enum FallingRestrictors
- Options for testing if a play space fall is valid
NoRestriction
- Always drop to nearest floor when the headset is no longer over the current standing object.LeftController
- Don't drop to nearest floor if the Left Controller is still over the current standing object even if the headset isn't.RightController
- Don't drop to nearest floor if the Right Controller is still over the current standing object even if the headset isn't.EitherController
- Don't drop to nearest floor if Either Controller is still over the current standing object even if the headset isn't.BothControllers
- Don't drop to nearest floor only if Both Controllers are still over the current standing object even if the headset isn't.AlwaysRestrict
- Never drop to nearest floor when the headset is no longer over the current standing object.StartFalling
- Emitted when a fall begins.StopFalling
- Emitted when a fall ends.StartMoving
- Emitted when movement in the play area begins.StopMoving
- Emitted when movement in the play area ends.StartColliding
- Emitted when the body collider starts colliding with another game object.StopColliding
- Emitted when the body collider stops colliding with another game object.StartLeaning
- Emitted when the body collider starts leaning over another game object.StopLeaning
- Emitted when the body collider stops leaning over another game object.StartTouchingGround
- Emitted when the body collider starts touching the ground.StopTouchingGround
- Emitted when the body collider stops touching the ground.Adding the VRTK_BodyPhysics_UnityEvents
component to VRTK_BodyPhysics
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.GameObject target
- The target GameObject the event is dealing with.Collider collider
- An optional collider that the body physics is colliding with.
public virtual bool ArePhysicsEnabled()
bool
- Returns true
if the body physics will interact with other scene physics objects and false
if the body physics will ignore other scene physics objects.The ArePhysicsEnabled method determines whether the body physics are set to interact with other scene physics objects.
public virtual void ApplyBodyVelocity(Vector3 velocity, bool forcePhysicsOn = false, bool applyMomentum = false)
Vector3 velocity
- The velocity to apply.bool forcePhysicsOn
- If true
will toggle the body collision physics back on if enable body collisions is true.bool applyMomentum
- If true
then the existing momentum of the play area will be applied as a force to the resulting velocity.The ApplyBodyVelocity method applies a given velocity to the rigidbody attached to the body physics.
public virtual void ToggleOnGround(bool state)
bool state
- If true
then body physics are set to being on the ground.The ToggleOnGround method sets whether the body is considered on the ground or not.
public virtual void TogglePreventSnapToFloor(bool state)
bool state
- If true
the the snap to floor mechanic will not execute.The PreventSnapToFloor method sets whether the snap to floor mechanic should be used.
public virtual void ForceSnapToFloor()
The ForceSnapToFloor method disables the prevent snap to floor and forces the snap to nearest floor action.
public virtual bool IsFalling()
bool
- Returns true
if the body is currently falling via gravity or via teleport.The IsFalling method returns the falling state of the body.
public virtual bool IsMoving()
bool
- Returns true if the user is currently walking around their play area space.The IsMoving method returns the moving within play area state of the body.
public virtual bool IsLeaning()
bool
- Returns true
if the user is considered to be leaning over an object.The IsLeaning method returns the leaning state of the user.
public virtual bool OnGround()
bool
- Returns true
if the play area is on the ground and false if the play area is in the air.The OnGround method returns whether the user is currently standing on the ground or not.
public virtual Vector3 GetVelocity()
Vector3
- The velocity of the body physics rigidbody.The GetVelocity method returns the velocity of the body physics rigidbody.
public virtual Vector3 GetAngularVelocity()
Vector3
- The angular velocity of the body physics rigidbody.The GetAngularVelocity method returns the angular velocity of the body physics rigidbody.
public virtual void ResetVelocities()
The ResetVelocities method sets the rigidbody velocity and angular velocity to zero to stop the Play Area rigidbody from continuing to move if it has a velocity already.
public virtual void ResetFalling()
The ResetFalling method force stops any falling states and conditions that might be set on this object.
public virtual GameObject GetBodyColliderContainer()
GameObject
- The auto generated body collider GameObject.GameObject
-The GetBodyColliderContainer method returns the auto generated GameObject that contains the body colliders.
public virtual GameObject GetFootColliderContainer()
GameObject
- The auto generated foot collider GameObject.GameObject
-The GetFootColliderContainer method returns the auto generated GameObject that contains the foot colliders.
public virtual GameObject GetCurrentCollidingObject()
GameObject
- The GameObject that is colliding with the body physics colliders.The GetCurrentCollidingObject method returns the object that the body physics colliders are currently colliding with.
public virtual void ResetIgnoredCollisions()
The ResetIgnoredCollisions method is used to clear any stored ignored colliders in case the Ignore Collisions On
array parameter is changed at runtime. This needs to be called manually if changes are made at runtime.
public virtual bool SweepCollision(Vector3 direction, float maxDistance)
Vector3 direction
- The direction to test for the potential collision.float maxDistance
- The maximum distance to check for a potential collision.bool
- Returns true
if a collision will occur on the given direction over the given maxium distance. Returns false
if there is no collision about to happen.The SweepCollision method tests to see if a collision will occur with the body collider in a given direction and distance.
VRTK/Examples/017_CameraRig_TouchpadWalking
has a collection of walls and slopes that can be traversed by the user with the touchpad but the user cannot pass through the objects as they are collidable and the rigidbody physics won't allow the intersection to occur.
Attempts to rewind the position of the play area to a last know valid position upon the headset collision event.
Required Components:
VRTK_BodyPhysics
- A Body Physics script to manage the collisions of the body presence within the scene.VRTK_HeadsetCollision
- A Headset Collision script to determine when the headset is colliding with valid geometry.Script Usage:
VRTK_PositionRewind
script on any active scene GameObject.Is Trigger = true
.public enum CollisionDetectors
- Valid collision detectors.
HeadsetOnly
- Listen for collisions on the headset collider only.BodyOnly
- Listen for collisions on the body physics collider only.HeadsetAndBody
- Listen for collisions on both the headset collider and body physics collider.PositionRewindToSafe
- Emitted when the draggable item is successfully dropped.Adding the VRTK_PositionRewind_UnityEvents
component to VRTK_PositionRewind
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.Vector3 collidedPosition
- The position of the play area when it collded.Vector3 resetPosition
- The position of the play area when it has been rewinded to a safe position.
public virtual void SetLastGoodPosition()
The SetLastGoodPosition method stores the current valid play area and headset position.
public virtual void RewindPosition()
The RewindPosition method resets the play area position to the last known good position of the play area.
VRTK/Examples/017_CameraRig_TouchpadWalking
has the position rewind script to reset the user's position if they walk into objects.
A collection of scripts that provide the ability to utilise and interact with Unity UI elements.
Denotes a Unity World UI Canvas can be interacted with a UIPointer script.
Script Usage:
VRTK_UICanvas
script on the Unity World UI Canvas to allow UIPointer interactions with.Script Dependencies:
0
is given then no auto activation will occur.VRTK/Examples/034_Controls_InteractingWithUnityUI
uses the VRTK_UICanvas
script on two of the canvases to show how the UI Pointer can interact with them.
Provides the ability to interact with UICanvas elements and the contained Unity UI elements within.
Optional Components:
VRTK_ControllerEvents
- The events component to listen for the button presses on. This must be applied on the same GameObject as this script if one is not provided via the Controller
parameter.Script Usage:
VRTK_UIPointer
script on either:
Transform
component to the Pointer Origin Transform
parameter of this script. This does not have to be a controller and can be any GameObject that will emit the UIPointer.Script Dependencies:
Click Method = Click_On_Button_Up
public enum ActivationMethods
- Methods of activation.
HoldButton
- Only activates the UI Pointer when the Pointer button on the controller is pressed and held down.ToggleButton
- Activates the UI Pointer on the first click of the Pointer button on the controller and it stays active until the Pointer button is clicked again.AlwaysOn
- The UI Pointer is always active regardless of whether the Pointer button on the controller is pressed or not.public enum ClickMethods
- Methods of when to consider a UI Click action
ClickOnButtonUp
- Consider a UI Click action has happened when the UI Click alias button is released.ClickOnButtonDown
- Consider a UI Click action has happened when the UI Click alias button is pressed.public GameObject autoActivatingCanvas
- The GameObject of the front trigger activator of the canvas currently being activated by this pointer. Default: null
public bool collisionClick
- Determines if the UI Pointer has collided with a valid canvas that has collision click turned on. Default: false
ActivationButtonPressed
- Emitted when the UI activation button is pressed.ActivationButtonReleased
- Emitted when the UI activation button is released.SelectionButtonPressed
- Emitted when the UI selection button is pressed.SelectionButtonReleased
- Emitted when the UI selection button is released.UIPointerElementEnter
- Emitted when the UI Pointer is colliding with a valid UI element.UIPointerElementExit
- Emitted when the UI Pointer is no longer colliding with any valid UI elements.UIPointerElementClick
- Emitted when the UI Pointer has clicked the currently collided UI element.UIPointerElementDragStart
- Emitted when the UI Pointer begins dragging a valid UI element.UIPointerElementDragEnd
- Emitted when the UI Pointer stops dragging a valid UI element.Adding the VRTK_UIPointer_UnityEvents
component to VRTK_UIPointer
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.VRTK_ControllerReference controllerReference
- The reference to the controller that was used.bool isActive
- The state of whether the UI Pointer is currently active or not.GameObject currentTarget
- The current UI element that the pointer is colliding with.GameObject previousTarget
- The previous UI element that the pointer was colliding with.RaycastResult raycastResult
- The raw raycast result of the UI ray collision.
public static float GetPointerLength(int pointerId)
int pointerId
- The pointer ID for the UI Pointer to recieve the length for.float
- The maximum length the UI Pointer will cast to.The GetPointerLength method retrieves the maximum UI Pointer length for the given pointer ID.
public virtual VRTK_VRInputModule SetEventSystem(EventSystem eventSystem)
EventSystem eventSystem
- The global Unity event system to be used by the UI pointers.VRTK_VRInputModule
- A custom input module that is used to detect input from VR pointers.The SetEventSystem method is used to set up the global Unity event system for the UI pointer. It also handles disabling the existing Standalone Input Module that exists on the EventSystem and adds a custom VRTK Event System VR Input component that is required for interacting with the UI with VR inputs.
public virtual void RemoveEventSystem()
The RemoveEventSystem resets the Unity EventSystem back to the original state before the VRTK_VRInputModule was swapped for it.
public virtual bool PointerActive()
bool
- Returns true
if the ui pointer should be currently active.The PointerActive method determines if the ui pointer beam should be active based on whether the pointer alias is being held and whether the Hold Button To Use parameter is checked.
public virtual bool IsActivationButtonPressed()
bool
- Returns true
if the activation button is active.The IsActivationButtonPressed method is used to determine if the configured activation button is currently in the active state.
public virtual bool IsSelectionButtonPressed()
bool
- Returns true
if the selection button is active.The IsSelectionButtonPressed method is used to determine if the configured selection button is currently in the active state.
public virtual bool ValidClick(bool checkLastClick, bool lastClickState = false)
bool checkLastClick
- If this is true then the last frame's state of the UI Click button is also checked to see if a valid click has happened.bool lastClickState
- This determines what the last frame's state of the UI Click button should be in for it to be a valid click.bool
- Returns true
if the UI Click button is in a valid state to action a click, returns false
if it is not in a valid state.The ValidClick method determines if the UI Click button is in a valid state to register a click action.
public virtual Vector3 GetOriginPosition()
Vector3
- A Vector3 of the pointer transform positionThe GetOriginPosition method returns the relevant transform position for the pointer based on whether the pointerOriginTransform variable is valid.
public virtual Vector3 GetOriginForward()
Vector3
- A Vector3 of the pointer transform forwardThe GetOriginPosition method returns the relevant transform forward for the pointer based on whether the pointerOriginTransform variable is valid.
VRTK/Examples/034_Controls_InteractingWithUnityUI
uses the VRTK_UIPointer
script on the right Controller to allow for the interaction with Unity UI elements using a Simple Pointer beam. The left Controller controls a Simple Pointer on the headset to demonstrate gaze interaction with Unity UI elements.
extends MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
Denotes a Unity UI Element as being draggable on the UI Canvas.
If a UI Draggable item is set to
Restrict To Drop Zone = true
then the UI Draggable item must be a child of an element that has the VRTK_UIDropZone script applied to it to ensure it starts in a valid drop zone.
Script Usage:
VRTK_UIDraggableItem
script on the Unity UI element that is to be dragged.public GameObject validDropZone
- The current valid drop zone the dragged element is hovering over.DraggableItemDropped
- Emitted when the draggable item is successfully dropped.DraggableItemReset
- Emitted when the draggable item is reset.Adding the VRTK_UIDraggableItem_UnityEvents
component to VRTK_UIDraggableItem
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.GameObject target
- The target the item is dragged onto.VRTK/Examples/034_Controls_InteractingWithUnityUI
demonstrates a collection of UI elements that are draggable
extends MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
Specifies a Unity UI Element as being a valid drop zone location for a UI Draggable element.
It's appropriate to use a Panel UI element as a drop zone with a layout group applied so new children dropped into the drop zone automatically align.
Script Usage:
VRTK_UIDropZone
script on the Unity UI element that is to become the drop zone.VRTK/Examples/034_Controls_InteractingWithUnityUI
demonstrates a collection of UI Drop Zones.
A collection of scripts that provide useful functionality to aid the creation process.
A helper class that simply holds references to both the SDK_ScriptingDefineSymbolPredicateAttribute and the method info of the method the attribute is defined on.
public readonly SDK_ScriptingDefineSymbolPredicateAttribute attribute
- The predicate attribute.public readonly MethodInfo methodInfo
- The method info of the method the attribute is defined on.public static ReadOnlyCollection<ScriptingDefineSymbolPredicateInfo> AvailableScriptingDefineSymbolPredicateInfos { get private set }
- All found scripting define symbol predicate attributes with associated method info.public static readonly Dictionary<Type, Type> SDKFallbackTypesByBaseType
- Specifies the fallback SDK types for every base SDK type. Default: new Dictionary<Type, Type>
public static ReadOnlyCollection<VRTK_SDKInfo> AvailableSystemSDKInfos { get private set }
- All available system SDK infos.public static ReadOnlyCollection<VRTK_SDKInfo> AvailableBoundariesSDKInfos { get private set }
- All available boundaries SDK infos.public static ReadOnlyCollection<VRTK_SDKInfo> AvailableHeadsetSDKInfos { get private set }
- All available headset SDK infos.public static ReadOnlyCollection<VRTK_SDKInfo> AvailableControllerSDKInfos { get private set }
- All available controller SDK infos.public static ReadOnlyCollection<VRTK_SDKInfo> InstalledSystemSDKInfos { get private set }
- All installed system SDK infos. This is a subset of AvailableSystemSDKInfos
. It contains only those available SDK infos for which an SDK_ScriptingDefineSymbolPredicateAttribute exists that uses the same symbol and whose associated method returns true.public static ReadOnlyCollection<VRTK_SDKInfo> InstalledBoundariesSDKInfos { get private set }
- All installed boundaries SDK infos. This is a subset of AvailableBoundariesSDKInfos
. It contains only those available SDK infos for which an SDK_ScriptingDefineSymbolPredicateAttribute exists that uses the same symbol and whose associated method returns true.public static ReadOnlyCollection<VRTK_SDKInfo> InstalledHeadsetSDKInfos { get private set }
- All installed headset SDK infos. This is a subset of AvailableHeadsetSDKInfos
. It contains only those available SDK infos for which an SDK_ScriptingDefineSymbolPredicateAttribute exists that uses the same symbol and whose associated method returns true.public static ReadOnlyCollection<VRTK_SDKInfo> InstalledControllerSDKInfos { get private set }
- All installed controller SDK infos. This is a subset of AvailableControllerSDKInfos
. It contains only those available SDK infos for which an SDK_ScriptingDefineSymbolPredicateAttribute exists that uses the same symbol and whose associated method returns true.public static VRTK_SDKManager instance
- The singleton instance to access the SDK Manager variables from.public static HashSet<Behaviour> delayedToggleBehaviours
- A collection of behaviours to toggle on loaded setup change. Default: new HashSet<Behaviour>()
public List<SDK_ScriptingDefineSymbolPredicateAttribute> activeScriptingDefineSymbolsWithoutSDKClasses
- The active (i.e. to be added to the PlayerSettings) scripting define symbol predicate attributes that have no associated SDK classes. Default: new List<SDK_ScriptingDefineSymbolPredicateAttribute>()
public VRTK_SDKSetup loadedSetup
- The loaded SDK Setup. null
if no setup is currently loaded.public ReadOnlyCollection<Behaviour> behavioursToToggleOnLoadedSetupChange { get private set }
- All behaviours that need toggling whenever loadedSetup
changes.LoadedSetupChanged
- The event invoked whenever the loaded SDK Setup changes.Adding the VRTK_SDKManager_UnityEvents
component to VRTK_SDKManager
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.VRTK_SDKSetup previousSetup
- The previous loaded Setup. null
if no previous Setup was loaded.VRTK_SDKSetup currentSetup
- The current loaded Setup. null
if no Setup is loaded anymore. See errorMessage
to check whether this is null
because of an error.string errorMessage
- Explains why loading a list of Setups wasn't successful if currentSetup
is null
and an error occurred. null
if no error occurred.
public ScriptingDefineSymbolPredicateInfo(SDK_ScriptingDefineSymbolPredicateAttribute attribute, MethodInfo methodInfo)
SDK_ScriptingDefineSymbolPredicateAttribute attribute
- The predicate attribute.MethodInfo methodInfo
- The method info of the method the attribute is defined on.Event Payload. Constructs a new instance with the specified predicate attribute and associated method info.
public static bool ValidInstance()
bool
- Returns true
if the SDK Manager instance is valid or returns false
if it is null.The ValidInstance method returns whether the SDK Manager isntance is valid (i.e. it's not null).
public static bool AttemptAddBehaviourToToggleOnLoadedSetupChange(Behaviour givenBehaviour)
Behaviour givenBehaviour
- The behaviour to add.bool
- Returns true
if the SDK Manager instance was valid.The AttemptAddBehaviourToToggleOnLoadedSetupChange method will attempt to add the given behaviour to the loaded setup change toggle if the SDK Manager instance exists. If it doesn't exist then it adds it to the delayedToggleBehaviours
HashSet to be manually added later with the ProcessDelayedToggleBehaviours
method.
public static bool AttemptRemoveBehaviourToToggleOnLoadedSetupChange(Behaviour givenBehaviour)
Behaviour givenBehaviour
- The behaviour to remove.bool
- Returns true
if the SDK Manager instance was valid.The AttemptRemoveBehaviourToToggleOnLoadedSetupChange method will attempt to remove the given behaviour from the loaded setup change toggle if the SDK Manager instance exists.
public static void ProcessDelayedToggleBehaviours()
The ProcessDelayedToggleBehaviours method will attempt to addd the behaviours in the delayedToggleBehaviours
HashSet to the loaded setup change toggle.
public static bool SubscribeLoadedSetupChanged(LoadedSetupChangeEventHandler callback)
LoadedSetupChangeEventHandler callback
- The callback to register.bool
- Returns true
if the SDK Manager instance was valid.The SubscribeLoadedSetupChanged method attempts to register the given callback with the LoadedSetupChanged
event.
public static bool UnsubscribeLoadedSetupChanged(LoadedSetupChangeEventHandler callback)
LoadedSetupChangeEventHandler callback
- The callback to unregister.bool
- Returns true
if the SDK Manager instance was valid.The UnsubscribeLoadedSetupChanged method attempts to unregister the given callback from the LoadedSetupChanged
event.
public static VRTK_SDKSetup GetLoadedSDKSetup()
VRTK_SDKSetup
- Returns true
if the SDK Manager instance was valid.The GetLoadedSDKSetup method returns the current loaded SDK Setup for the SDK Manager instance.
public static VRTK_SDKSetup[] GetAllSDKSetups()
VRTK_SDKSetup[]
- An SDKSetup array of all valid SDK Setups for the current SDK Manager instance. If no SDK Manager instance is found then an empty array is returned.The GetAllSDKSetups method returns all valid SDK Setups attached to the SDK Manager instance.
public static bool AttemptTryLoadSDKSetup(int startIndex, bool tryToReinitialize, params VRTK_SDKSetup[] sdkSetups)
int startIndex
- The index of the VRTK_SDKSetup to start the loading with.bool tryToReinitialize
- Whether or not to retry initializing and using the currently set but unusable VR Device.params VRTK_SDKSetup[] sdkSetups
- The list to try to load a VRTK_SDKSetup from.bool
- Returns true
if the SDK Manager instance was valid.The AttemptTryLoadSDKSetup method attempts to load a valid VRTK_SDKSetup from a list if the SDK Manager instance is valid.
public static bool AttemptTryLoadSDKSetupFromList(bool tryUseLastLoadedSetup = true)
bool tryUseLastLoadedSetup
- Attempt to use the last loaded setup if it's available.bool
- Returns true
if the SDK Manager instance was valid.The AttemptUnloadSDKSetup method tries to load a valid VRTK_SDKSetup from setups if the SDK Manager instance is valid.
public static bool AttemptUnloadSDKSetup(bool disableVR = false)
bool disableVR
- Whether to disable VR altogether after unloading the SDK Setup.bool
- Returns true
if the SDK Manager instance was valid.The AttemptUnloadSDKSetup method attempts to unload the currently loaded VRTK_SDKSetup, if there is one and if the SDK Manager instance is valid.
public bool ManageScriptingDefineSymbols(bool ignoreAutoManageScriptDefines, bool ignoreIsActiveAndEnabled)
bool ignoreAutoManageScriptDefines
- Whether to ignore autoManageScriptDefines
while deciding to manage.bool ignoreIsActiveAndEnabled
- Whether to ignore Behaviour.isActiveAndEnabled
while deciding to manage.bool
- Whether the PlayerSettings' scripting define symbols were changed.The ManageScriptingDefineSymbols method manages (i.e. adds and removes) the scripting define symbols of the PlayerSettings for the currently set SDK infos. This method is only available in the editor, so usage of the method needs to be surrounded by #if UNITY_EDITOR
and #endif
when used in a type that is also compiled for a standalone build.
public void ManageVRSettings(bool force)
bool force
- Whether to ignore autoManageVRSettings
while deciding to manage.The ManageVRSettings method manages (i.e. adds and removes) the VR SDKs of the PlayerSettings for the currently set SDK infos. This method is only available in the editor, so usage of the method needs to be surrounded by #if UNITY_EDITOR
and #endif
when used in a type that is also compiled for a standalone build.
public void AddBehaviourToToggleOnLoadedSetupChange(Behaviour behaviour)
Behaviour behaviour
- The behaviour to add.The AddBehaviourToToggleOnLoadedSetupChange method adds a behaviour to the list of behaviours to toggle when loadedSetup
changes.
public void RemoveBehaviourToToggleOnLoadedSetupChange(Behaviour behaviour)
Behaviour behaviour
- The behaviour to remove.The RemoveBehaviourToToggleOnLoadedSetupChange method removes a behaviour of the list of behaviours to toggle when loadedSetup
changes.
public void TryLoadSDKSetupFromList(bool tryUseLastLoadedSetup = true)
bool tryUseLastLoadedSetup
- Attempt to use the last loaded setup if it's available.The TryLoadSDKSetupFromList method tries to load a valid VRTK_SDKSetup from setups.
public void TryLoadSDKSetup(int startIndex, bool tryToReinitialize, params VRTK_SDKSetup[] sdkSetups)
int startIndex
- The index of the VRTK_SDKSetup to start the loading with.bool tryToReinitialize
- Whether or not to retry initializing and using the currently set but unusable VR Device.params VRTK_SDKSetup[] sdkSetups
- The list to try to load a VRTK_SDKSetup from.The TryLoadSDKSetup method tries to load a valid VRTK_SDKSetup from a list. The first loadable VRTK_SDKSetup in the list will be loaded. Will fall back to disable VR if none of the provided Setups is useable.
public void SetLoadedSDKSetupToPopulateObjectReferences(VRTK_SDKSetup setup)
VRTK_SDKSetup setup
- The SDK Setup to set as the loaded SDK.The SetLoadedSDKSetupToPopulateObjectReferences method sets a given VRTK_SDKSetup as the loaded SDK Setup to be able to use it when populating object references in the SDK Setup. This method should only be called when not playing as it's only for populating the object references. This method is only available in the editor, so usage of the method needs to be surrounded by #if UNITY_EDITOR
and #endif
when used in a type that is also compiled for a standalone build.
public void UnloadSDKSetup(bool disableVR = false)
bool disableVR
- Whether to disable VR altogether after unloading the SDK Setup.The UnloadSDKSetup method unloads the currently loaded VRTK_SDKSetup, if there is one.
The SDK Setup describes a list of SDKs and game objects to use.
public VRTK_SDKInfo systemSDKInfo
- The info of the SDK to use to deal with all system actions. By setting this to null
the fallback SDK will be used.public VRTK_SDKInfo boundariesSDKInfo
- The info of the SDK to use to utilize room scale boundaries. By setting this to null
the fallback SDK will be used.public VRTK_SDKInfo headsetSDKInfo
- The info of the SDK to use to utilize the VR headset. By setting this to null
the fallback SDK will be used.public VRTK_SDKInfo controllerSDKInfo
- The info of the SDK to use to utilize the input devices. By setting this to null
the fallback SDK will be used.public SDK_BaseSystem systemSDK
- The selected system SDK.public SDK_BaseBoundaries boundariesSDK
- The selected boundaries SDK.public SDK_BaseHeadset headsetSDK
- The selected headset SDK.public SDK_BaseController controllerSDK
- The selected controller SDK.public string[] usedVRDeviceNames
- The VR device names used by the currently selected SDKs.public bool isValid
- Whether it's possible to use the Setup. See GetSimplifiedErrorDescriptions
for more info.Adding the VRTK_SDKSetup_UnityEvents
component to VRTK_SDKSetup
object allows access to UnityEvents
that will react identically to the Class Events.
On
prefix. e.g. MyEvent
-> OnMyEvent
.
public void PopulateObjectReferences(bool force)
bool force
- Whether to ignore autoPopulateObjectReferences
while deciding to populate.The PopulateObjectReferences method populates the object references by using the currently set SDKs.
public string[] GetSimplifiedErrorDescriptions()
string[]
- An array of all the error descriptions. Returns an empty array if no errors are found.The GetSimplifiedErrorDescriptions method checks the setup for errors and creates an array of error descriptions. The returned error descriptions handle the following cases for the current SDK infos:
public void OnLoaded(VRTK_SDKManager sender)
VRTK_SDKManager sender
- The SDK Manager that has loaded the SDK Setup.The OnLoaded method determines when an SDK Setup has been loaded.
public void OnUnloaded(VRTK_SDKManager sender)
VRTK_SDKManager sender
- The SDK Manager that has unloaded the SDK Setup.The OnUnloaded method determines when an SDK Setup has been unloaded.
extends ISerializationCallbackReceiver
Holds all the info necessary to describe an SDK.
public Type type { get private set }
- The type of the SDK.public string originalTypeNameWhenFallbackIsUsed { get private set }
- The name of the type of which this SDK info was created from. This is only used if said type wasn't found.public SDK_DescriptionAttribute description { get private set }
- The description of the SDK.
public static VRTK_SDKInfo[] Create<BaseType, FallbackType, ActualType>() where BaseType : SDK_Base where FallbackType : BaseType where ActualType : BaseType
BaseType
- The SDK base type. Must be a subclass of SDK_Base.FallbackType
- The SDK type to fall back on if problems occur. Must be a subclass of BaseType
.ActualType
- The SDK type to use. Must be a subclass of BaseType
.VRTK_SDKInfo[]
- Multiple newly created instances.Creates new SDK infos for a type that is known at compile time.
public static VRTK_SDKInfo[] Create<BaseType, FallbackType>(Type actualType) where BaseType : SDK_Base where FallbackType : BaseType
BaseType
- The SDK base type. Must be a subclass of SDK_Base.FallbackType
- The SDK type to fall back on if problems occur. Must be a subclass of `BaseType.Type actualType
- The SDK type to use. Must be a subclass of `BaseType.VRTK_SDKInfo[]
- Multiple newly created instances.Creates new SDK infos for a type.
public VRTK_SDKInfo(VRTK_SDKInfo infoToCopy)
VRTK_SDKInfo infoToCopy
- The SDK info to copy.Creates a new SDK info by copying an existing one.
The Device Finder offers a collection of static methods that can be called to find common game devices such as the headset or controllers, or used to determine key information about the connected devices.
public enum Devices
- Possible devices.
Headset
- The headset.LeftController
- The left hand controller.RightController
- The right hand controller.public enum Headsets
- Possible headsets
Unknown
- An unknown headset.OculusRift
- A summary of all Oculus Rift headset versions.OculusRiftCV1
- A specific version of the Oculus Rift headset, the Consumer Version 1.Vive
- A summary of all HTC Vive headset versions.ViveMV
- A specific version of the HTC Vive headset, the first consumer version.ViveDVT
- A specific version of the HTC Vive headset, the first consumer version.OculusRiftES07
- A specific version of the Oculus Rift headset, the rare ES07.
public static SDK_BaseController.ControllerType GetCurrentControllerType(VRTK_ControllerReference controllerReference = null)
VRTK_ControllerReference controllerReference
- The reference to the controller to get type of.SDK_BaseController.ControllerType
- The ControllerType based on the SDK and headset being used.The GetCurrentControllerType method returns the current used ControllerType based on the SDK and headset being used.
public static uint GetControllerIndex(GameObject controller)
GameObject controller
- The controller object to get the index of a controller.uint
- The index of the given controller.The GetControllerIndex method is used to find the index of a given controller object.
public static GameObject GetControllerByIndex(uint index, bool getActual)
uint index
- The index of the actual controller to find.bool getActual
- An optional parameter that if true will return the game object that the SDK controller is attached to.GameObject
- The actual controller GameObject that matches the given index.The GetControllerByIndex method is used to find a controller based on it's unique index.
public static Transform GetControllerOrigin(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to get the origin for.Transform
- The transform of the controller origin or if an origin is not set then the transform parent.The GetControllerOrigin method is used to find the controller's origin.
public static Transform DeviceTransform(Devices device)
Devices device
- The Devices enum to get the transform for.Transform
- The transform for the given Devices enum.The DeviceTransform method returns the transform for a given Devices enum.
public static SDK_BaseController.ControllerHand GetControllerHandType(string hand)
string hand
- The string representation of the hand to retrieve the type of. left
or right
.SDK_BaseController.ControllerHand
- A ControllerHand representing either the Left or Right hand.The GetControllerHandType method is used for getting the enum representation of ControllerHand from a given string.
public static SDK_BaseController.ControllerHand GetControllerHand(GameObject controller)
GameObject controller
- The controller game object to check the hand of.SDK_BaseController.ControllerHand
- A ControllerHand representing either the Left or Right hand.The GetControllerHand method is used for getting the enum representation of ControllerHand for the given controller game object.
public static GameObject GetControllerLeftHand(bool getActual = false)
bool getActual
- An optional parameter that if true will return the game object that the SDK controller is attached to.GameObject
- The left hand controller.The GetControllerLeftHand method retrieves the game object for the left hand controller.
public static GameObject GetControllerRightHand(bool getActual = false)
bool getActual
- An optional parameter that if true will return the game object that the SDK controller is attached to.GameObject
- The right hand controller.The GetControllerRightHand method retrieves the game object for the right hand controller.
public static VRTK_ControllerReference GetControllerReferenceLeftHand()
VRTK_ControllerReference
- The Controller Reference for the left hand controller.The GetControllerReferenceLeftHand returns a Controller Reference for the left hand controller.
public static VRTK_ControllerReference GetControllerReferenceRightHand()
VRTK_ControllerReference
- The Controller Reference for the right hand controller.The GetControllerReferenceRightHand returns a Controller Reference for the right hand controller.
public static VRTK_ControllerReference GetControllerReferenceForHand(SDK_BaseController.ControllerHand hand)
VRTK_ControllerReference
- The Controller Reference for the given hand controller.The GetControllerReferenceForHand returns a Controller Reference for the given hand controller.
public static bool IsControllerOfHand(GameObject checkController, SDK_BaseController.ControllerHand hand)
GameObject checkController
- The actual controller object that is being checked.SDK_BaseController.ControllerHand hand
- The representation of a hand to check if the given controller matches.bool
- Is true if the given controller matches the given hand.The IsControllerOfHand method is used to check if a given controller game object is of the hand type provided.
public static bool IsControllerLeftHand(GameObject checkController)
GameObject checkController
- The controller object that is being checked.bool
- Is true if the given controller is the left controller.The IsControllerLeftHand method is used to check if a given controller game object is the left handed controller.
public static bool IsControllerRightHand(GameObject checkController)
GameObject checkController
- The controller object that is being checked.bool
- Is true if the given controller is the right controller.The IsControllerRightHand method is used to check if a given controller game object is the right handed controller.
public static SDK_BaseController.ControllerHand GetOppositeHand(SDK_BaseController.ControllerHand currentHand)
SDK_BaseController.ControllerHand currentHand
- The current hand.SDK_BaseController.ControllerHand
- The opposite hand.The GetOppositeHand method returns the other hand type from the current hand given.
public static GameObject GetActualController(GameObject givenController)
GameObject givenController
- The GameObject of the controller.GameObject
- The GameObject that is the actual controller.The GetActualController method will attempt to get the actual SDK controller object.
public static GameObject GetScriptAliasController(GameObject givenController)
GameObject givenController
- The GameObject of the controller.GameObject
- The GameObject that is the alias controller containing the scripts.The GetScriptAliasController method will attempt to get the object that contains the scripts for the controller.
public static GameObject GetModelAliasController(GameObject givenController)
GameObject givenController
- The GameObject of the controller.GameObject
- The GameObject that is the alias controller containing the controller model.The GetModelAliasController method will attempt to get the object that contains the model for the controller.
public static SDK_BaseController.ControllerHand GetModelAliasControllerHand(GameObject givenObject)
GameObject givenObject
- The GameObject that may represent a model alias.SDK_BaseController.ControllerHand
- The enum of the ControllerHand that the given GameObject may represent.The GetModelAliasControllerHand method will return the hand that the given model alias GameObject is for.
public static Vector3 GetControllerVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller.Vector3
- A 3 dimensional vector containing the current real world physical controller velocity.The GetControllerVelocity method is used for getting the current velocity of the physical game controller. This can be useful to determine the speed at which the controller is being swung or the direction it is being moved in.
public static Vector3 GetControllerAngularVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller.Vector3
- A 3 dimensional vector containing the current real world physical controller angular (rotational) velocity.The GetControllerAngularVelocity method is used for getting the current rotational velocity of the physical game controller. This can be useful for determining which way the controller is being rotated and at what speed the rotation is occurring.
public static Vector3 GetHeadsetVelocity()
Vector3
- A Vector3 containing the current velocity of the headset.The GetHeadsetVelocity method is used to determine the current velocity of the headset.
public static Vector3 GetHeadsetAngularVelocity()
Vector3
- A Vector3 containing the current angular velocity of the headset.The GetHeadsetAngularVelocity method is used to determine the current angular velocity of the headset.
public static Transform HeadsetTransform()
Transform
- The transform of the VR Headset component.The HeadsetTransform method is used to retrieve the transform for the VR Headset in the scene. It can be useful to determine the position of the user's head in the game world.
public static Transform HeadsetCamera()
Transform
- The transform of the VR Camera component.The HeadsetCamera method is used to retrieve the transform for the VR Camera in the scene.
public static string GetHeadsetTypeAsString()
string
- The string of the headset connected.The GetHeadsetTypeAsString method returns a string representing the type of headset connected.
public static SDK_BaseHeadset.HeadsetType GetHeadsetType()
SDK_BaseHeadset.HeadsetType
- The Headset type that is connected.The GetHeadsetType method returns the type of headset currently connected.
public static Transform PlayAreaTransform()
Transform
- The transform of the VR Play Area component.The PlayAreaTransform method is used to retrieve the transform for the play area in the scene.
The Shared Methods script is a collection of reusable static methods that are used across a range of different scripts.
public static Bounds GetBounds(Transform transform, Transform excludeRotation = null, Transform excludeTransform = null)
Transform transform
-Transform excludeRotation
- Resets the rotation of the transform temporarily to 0 to eliminate skewed bounds.Transform excludeTransform
- Does not consider the stated object when calculating the bounds.Bounds
- The bounds of the transform.The GetBounds methods returns the bounds of the transform including all children in world space.
public static bool IsLowest(float value, float[] others)
float value
- The value to check to see if it is lowest.float[] others
- The array of values to check against.bool
- Returns true if the value is lower than all numbers in the given array, returns false if it is not the lowest.The IsLowest method checks to see if the given value is the lowest number in the given array of values.
public static Transform AddCameraFade()
Transform
- The transform of the headset camera.The AddCameraFade method finds the headset camera and adds a headset fade script to it.
public static void CreateColliders(GameObject obj)
GameObject obj
- The game object to attempt to add the colliders to.The CreateColliders method attempts to add box colliders to all child objects in the given object that have a renderer but no collider.
public static Collider[] ColliderExclude(Collider[] setA, Collider[] setB)
Collider[] setA
- The array that contains all of the relevant colliders.Collider[] setB
- The array that contains the colliders to remove from setA.Collider[]
- A Collider array that is a subset of setA that doesn't contain the colliders from setB.The ColliderExclude method reduces the colliders in the setA array by those matched in the setB array.
public static Collider[] GetCollidersInGameObjects(GameObject[] gameObjects, bool searchChildren, bool includeInactive)
GameObject[] gameObjects
- An array of GameObjects to get the colliders for.bool searchChildren
- If this is true
then the given GameObjects will also have their child GameObjects searched for colliders.bool includeInactive
- If this is true
then the inactive GameObjects in the array will also be checked for Colliders. Only relevant if searchChildren
is true
.Collider[]
- An array of Colliders that are found in the given GameObject array.The GetCollidersInGameObjects method iterates through a GameObject array and returns all of the unique found colliders for all GameObejcts.
public static Component CloneComponent(Component source, GameObject destination, bool copyProperties = false)
Component source
- The component to copy.GameObject destination
- The game object to copy the component to.bool copyProperties
- Determines whether the properties of the component as well as the fields should be copied.Component
- The component that has been cloned onto the given game object.The CloneComponent method takes a source component and copies it to the given destination game object.
public static Color ColorDarken(Color color, float percent)
Color color
- The source colour to apply the darken to.float percent
- The percent to darken the colour by.Color
- The new colour with the darken applied.The ColorDarken method takes a given colour and darkens it by the given percentage.
public static float RoundFloat(float givenFloat, int decimalPlaces, bool rawFidelity = false)
float givenFloat
- The float to round.int decimalPlaces
- The number of decimal places to round to.bool rawFidelity
- If this is true then the decimal places must be given in the decimal multiplier, e.g. 10 for 1dp, 100 for 2dp, etc.float
- The rounded float.The RoundFloat method is used to round a given float to the given decimal places.
public static bool IsEditTime()
bool
- Returns true if Unity is in the Unity Editor and not in play mode.The IsEditTime method determines if the state of Unity is in the Unity Editor and the scene is not in play mode.
public static float Mod(float a, float b)
float a
- The dividend value.float b
- The divisor value.float
- The remainder value.The Mod method is used to find the remainder of the sum a/b.
public static GameObject FindEvenInactiveGameObject<T>(string gameObjectName = null, bool searchAllScenes = false) where T : Component
T
- The component type that needs to be on an ancestor of the wanted GameObject. Must be a subclass of Component
.string gameObjectName
- The name of the wanted GameObject. If it contains a '/' character, this method traverses the hierarchy like a path name, beginning on the game object that has a component of type T
.bool searchAllScenes
- If this is true, all loaded scenes will be searched. If this is false, only the active scene will be searched.GameObject
- The GameObject with name gameObjectName
and an ancestor that has a T
. If no such GameObject is found then null
is returned.Finds the first GameObject with a given name and an ancestor that has a specific component. This method returns active as well as inactive GameObjects in all scenes. It doesn't return assets. For performance reasons it is recommended to not use this function every frame. Cache the result in a member variable at startup instead.
public static T[] FindEvenInactiveComponents<T>(bool searchAllScenes = false) where T : Component
T
- The component type to search for. Must be a subclass of Component
.bool searchAllScenes
- If this is true, all loaded scenes will be searched. If this is false, only the active scene will be searched.T[]
- All the found components. If no component is found an empty array is returned.Finds all components of a given type. This method returns components from active as well as inactive GameObjects in all scenes. It doesn't return assets. For performance reasons it is recommended to not use this function every frame. Cache the result in a member variable at startup instead.
public static T FindEvenInactiveComponent<T>(bool searchAllScenes = false) where T : Component
T
- The component type to search for. Must be a subclass of Component
.bool searchAllScenes
- If this is true, all loaded scenes will be searched. If this is false, only the active scene will be searched.T
- The found component. If no component is found null
is returned.Finds the first component of a given type. This method returns components from active as well as inactive GameObjects in all scenes. It doesn't return assets. For performance reasons it is recommended to not use this function every frame. Cache the result in a member variable at startup instead.
public static string GenerateVRTKObjectName(bool autoGen, params object[] replacements)
bool autoGen
- An additiona [AUTOGEN] prefix will be added if this is true.params object[] replacements
- A collection of parameters to add to the generated name.string
- The generated name string.The GenerateVRTKObjectName method is used to create a standard name string for any VRTK generated object.
public static float GetGPUTimeLastFrame()
float
- The total GPU time utilized last frame as measured by the VR subsystem.The GetGPUTimeLastFrame retrieves the time spent by the GPU last frame, in seconds, as reported by the VR SDK.
public static bool Vector2ShallowCompare(Vector2 vectorA, Vector2 vectorB, int compareFidelity)
Vector2 vectorA
- The Vector2 to compare against.Vector2 vectorB
- The Vector2 to compare withint compareFidelity
- The number of decimal places to use when doing the comparison on the float elements within the Vector2.bool
- Returns true
if the given Vector2 objects match based on the given fidelity.The Vector2ShallowCompare method compares two given Vector2 objects based on the given fidelity, which is the equivalent of comparing rounded Vector2 elements to determine if the Vector2 elements are equal.
public static bool Vector3ShallowCompare(Vector3 vectorA, Vector3 vectorB, float threshold)
Vector3 vectorA
- The Vector3 to compare against.Vector3 vectorB
- The Vector3 to compare withfloat threshold
- The distance in which the two Vector3 objects can be within to be considered truebool
- Returns true
if the given Vector3 objects are within the given threshold distance.The Vector3ShallowCompare method compares two given Vector3 objects based on the given threshold, which is the equavelent of checking the distance between two Vector3 objects are above the threshold distance.
public static float NumberPercent(float value, float percent)
float value
- The value to determine the percentage fromfloat percent
- The percentage to find within the given value.float
- A float containing the percentage value based on the given input.The NumberPercent method is used to determine the percentage of a given value.
public static void SetGlobalScale(this Transform transform, Vector3 globalScale)
this Transform transform
- The reference to the transform to scale.Vector3 globalScale
- A Vector3 of a global scale to apply to the given transform.The SetGlobalScale method is used to set a transform scale based on a global scale instead of a local scale.
public static Vector3 VectorHeading(Vector3 originPosition, Vector3 targetPosition)
Vector3 originPosition
- The point to use as the originating position for the heading calculation.Vector3 targetPosition
- The point to use as the target position for the heading calculation.Vector3
- A Vector3 containing the heading changes of the target position in relation to the origin position.The VectorHeading method calculates the current heading of the target position in relation to the origin position.
public static Vector3 VectorDirection(Vector3 originPosition, Vector3 targetPosition)
Vector3 originPosition
- The point to use as the originating position for the direction calculation.Vector3 targetPosition
- The point to use as the target position for the direction calculation.Vector3
- A Vector3 containing the direction of the target position in relation to the origin position.The VectorDirection method calculates the direction the target position is in relation to the origin position.
public static float DividerToMultiplier(float value)
float value
- The number to convert into the multplier value.float
- The calculated number that can replace the divider number in a multiplication sum.The DividerToMultiplier method takes a number to be used in a division and converts it to be used for multiplication. (e.g. 2 / 2 becomes 2 * 0.5)
public static float NormalizeValue(float value, float minValue, float maxValue, float threshold = 0f)
float value
- The actual value to normalize.float minValue
- The minimum value the actual value can be.float maxValue
- The maximum value the actual value can be.float threshold
- The threshold to force to the minimum or maximum value if the normalized value is within the threhold limits.float
-The NormalizeValue method takes a given value between a specified range and returns the normalized value between 0f and 1f.
public static Vector3 AxisDirection(int axisIndex, Transform givenTransform = null)
int axisIndex
- The axis index of the axis. 0 = x
1 = y
2 = z
Transform givenTransform
- An optional Transform to get the Axis Direction for. If this is null
then the World directions will be used.Vector3
- The direction Vector3 based on the given axis index.The AxisDirection method returns the relevant direction Vector3 based on the axis index in relation to x,y,z.
public static bool AddListValue<TValue>(List<TValue> list, TValue value, bool preventDuplicates = false)
TValue
- The datatype for the list value.List<TValue> list
- The list to retrieve the value from.TValue value
- The value to attempt to add to the list.bool preventDuplicates
- If this is false
then the value provided will always be appended to the list. If this is true
the value provided will only be added to the list if it doesn't already exist.bool
- Returns true
if the given value was successfully added to the list. Returns false
if the given value already existed in the list and preventDuplicates
is true
.The AddListValue method adds the given value to the given list. If preventDuplicates
is true
then the given value will only be added if it doesn't already exist in the given list.
public static TValue GetDictionaryValue<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue = default(TValue), bool setMissingKey = false)
TKey
- The datatype for the dictionary key.TValue
- The datatype for the dictionary value.Dictionary<TKey, TValue> dictionary
- The dictionary to retrieve the value from.TKey key
- The key to retrieve the value for.TValue defaultValue
- The value to utilise when either setting the missing key (if setMissingKey
is true
) or the default value to return when no key is found (if setMissingKey
is false
).bool setMissingKey
- If this is true
and the given key is not present, then the dictionary value for the given key will be set to the defaultValue
parameter. If this is false
and the given key is not present then the defaultValue
parameter will be returned as the value.TValue
- The found value for the given key in the given dictionary, or the default value if no key is found.The GetDictionaryValue method attempts to retrieve a value from a given dictionary for the given key. It removes the need for a double dictionary lookup to ensure the key is valid and has the option of also setting the missing key value to ensure the dictionary entry is valid.
public static TValue GetDictionaryValue<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, out bool keyExists, TValue defaultValue = default(TValue), bool setMissingKey = false)
TKey
- The datatype for the dictionary key.TValue
- The datatype for the dictionary value.Dictionary<TKey, TValue> dictionary
- The dictionary to retrieve the value from.TKey key
- The key to retrieve the value for.out bool keyExists
- Sets the given parameter to true
if the key exists in the given dictionary or sets to false
if the key didn't existing in the given dictionary.TValue defaultValue
- The value to utilise when either setting the missing key (if setMissingKey
is true
) or the default value to return when no key is found (if setMissingKey
is false
).bool setMissingKey
- If this is true
and the given key is not present, then the dictionary value for the given key will be set to the defaultValue
parameter. If this is false
and the given key is not present then the defaultValue
parameter will be returned as the value.TValue
- The found value for the given key in the given dictionary, or the default value if no key is found.The GetDictionaryValue method attempts to retrieve a value from a given dictionary for the given key. It removes the need for a double dictionary lookup to ensure the key is valid and has the option of also setting the missing key value to ensure the dictionary entry is valid.
public static bool AddDictionaryValue<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, TValue value, bool overwriteExisting = false)
TKey
- The datatype for the dictionary key.TValue
- The datatype for the dictionary value.Dictionary<TKey, TValue> dictionary
- The dictionary to set the value for.TKey key
- The key to set the value for.TValue value
- The value to set at the given key in the given dictionary.bool overwriteExisting
- If this is true
then the value for the given key will always be set to the provided value. If this is false
then the value for the given key will only be set if the given key is not found in the given dictionary.bool
- Returns true
if the given value was successfully added to the dictionary at the given key. Returns false
if the given key already existed in the dictionary and overwriteExisting
is false
.The AddDictionaryValue method attempts to add a value for the given key in the given dictionary if the key does not already exist. If overwriteExisting
is true
then it always set the value even if they key exists.
public static Type GetTypeUnknownAssembly(string typeName)
string typeName
- The name of the type to get.Type
- The Type, or null if none is found.The GetTypeUnknownAssembly method is used to find a Type without knowing the exact assembly it is in.
public static float GetEyeTextureResolutionScale()
float
- Returns a float with the render scale for the resolution.The GetEyeTextureResolutionScale method returns the render scale for the resolution.
public static void SetEyeTextureResolutionScale(float value)
float value
- The value to set the render scale to.The SetEyeTextureResolutionScale method sets the render scale for the resolution.
public static bool IsTypeSubclassOf(Type givenType, Type givenBaseType)
Type givenType
- The Type to check.Type givenBaseType
- The base Type to check.bool
- Returns true
if the given type is a subclass of the given base type.The IsTypeSubclassOf checks if a given Type is a subclass of another given Type.
public static object[] GetTypeCustomAttributes(Type givenType, Type attributeType, bool inherit)
Type givenType
- The type to get the custom attributes for.Type attributeType
- The attribute type.bool inherit
- Whether to inherit attributes.object[]
- Returns an object array of custom attributes.The GetTypeCustomAttributes method gets the custom attributes of a given type.
public static Type GetBaseType(Type givenType)
Type givenType
- The type to return the base Type for.Type
- Returns the base Type.The GetBaseType method returns the base Type for the given Type.
public static bool IsTypeAssignableFrom(Type givenType, Type sourceType)
Type givenType
- The Type to check on.Type sourceType
- The Type to check if the given Type is assignable from.bool
- Returns true
if the given Type is assignable from the source Type.The IsTypeAssignableFrom method determines if the given Type is assignable from the source Type.
public static Type GetNestedType(Type givenType, string name)
Type givenType
- The Type to check on.string name
- The name of the nested Type.Type
- Returns the nested Type.The GetNestedType method returns the nested Type of the given Type.
public static string GetPropertyFirstName<T>()
T
- The type to check the first property on.string
- Returns a string representation of the first property name for the given Type.The GetPropertyFirstName method returns the string name of the first property on a given Type.
public static string[] GetCommandLineArguements()
string[]
- Returns an array of command line arguements as strings.The GetCommandLineArguements method returns the command line arguements for the environment.
public static Type[] GetTypesOfType(Type givenType)
Type givenType
- The Type to check on.Type[]
- An array of Types found.The GetTypesOfType method returns an array of Types for the given Type.
public static Type[] GetExportedTypesOfType(Type givenType)
Type givenType
- The Type to check on.Type[]
- An array of Exported Types found.The GetExportedTypesOfType method returns an array of Exported Types for the given Type.
public static bool IsTypeAbstract(Type givenType)
Type givenType
- The Type to check on.bool
- Returns true
if the given type is abstract.The IsTypeAbstract method determines if a given Type is abstract.
The Policy List allows to create a list of either tag names, script names or layer names that can be checked against to see if another operation is permitted.
A number of other scripts can use a Policy List to determine if an operation is permitted based on whether a game object has a tag applied, a script component on it or whether it's on a given layer.
For example, the Teleporter scripts can ignore game object targets as a teleport location if the game object contains a tag that is in the identifiers list and the policy is set to ignore.
Or the teleporter can only allow teleport to targets that contain a tag that is in the identifiers list and the policy is set to include.
Add the Policy List script to a game object (preferably the same component utilising the list) and then configure the list accordingly.
Then in the component that has a Policy List paramter (e.g. BasicTeleporter has Target List Policy
) simply select the list that has been created and defined.
public enum OperationTypes
- The operation to apply on the list of identifiers.
Ignore
- Will ignore any game objects that contain either a tag or script component that is included in the identifiers list.Include
- Will only include game objects that contain either a tag or script component that is included in the identifiers list.public enum CheckTypes
- The types of element that can be checked against.
Tag = 1
- The tag applied to the game object.Script = 2
- A script component added to the game object.Layer = 4
- A layer applied to the game object.
public virtual bool Find(GameObject obj)
GameObject obj
- The game object to check if it has a tag or script that is listed in the identifiers list.bool
- If the operation is Ignore
and the game object is matched by an identifier from the list then it returns true. If the operation is Include
and the game object is not matched by an identifier from the list then it returns true.The Find method performs the set operation to determine if the given game object contains one of the identifiers on the set check type. For instance, if the Operation is Ignore
and the Check Type is Tag
then the Find method will attempt to see if the given game object has a tag that matches one of the identifiers.
public static bool Check(GameObject obj, VRTK_PolicyList list)
GameObject obj
- The game object to check.VRTK_PolicyList list
- The policy list to use for checking.bool
- Returns true of the given game object matches the policy list or given string logic.The Check method is used to check if a game object should be ignored based on a given string or policy list.
A Custom Raycast allows to specify custom options for a Physics.Raycast.
A number of other scripts can utilise a Custom Raycast to further customise the raycasts that the scripts use internally.
For example, the VRTK_BodyPhysics script can be set to ignore trigger colliders when casting to see if it should teleport up or down to the nearest floor.
public static bool Raycast(VRTK_CustomRaycast customCast, Ray ray, out RaycastHit hitData, LayerMask ignoreLayers, float length = Mathf.Infinity, QueryTriggerInteraction affectTriggers = QueryTriggerInteraction.UseGlobal)
VRTK_CustomRaycast customCast
- The optional object with customised cast parameters.Ray ray
- The Ray to cast with.out RaycastHit hitData
- The raycast hit data.LayerMask ignoreLayers
- A layermask of layers to ignore from the raycast.float length
- The maximum length of the raycast.QueryTriggerInteraction affectTriggers
- Determines the trigger interaction level of the cast.bool
- Returns true if the raycast successfully collides with a valid object.The Raycast method is used to generate a raycast either from the given CustomRaycast object or a default Physics.Raycast.
public static bool Linecast(VRTK_CustomRaycast customCast, Vector3 startPosition, Vector3 endPosition, out RaycastHit hitData, LayerMask ignoreLayers, QueryTriggerInteraction affectTriggers = QueryTriggerInteraction.UseGlobal)
VRTK_CustomRaycast customCast
- The optional object with customised cast parameters.Vector3 startPosition
- The world position to start the linecast from.Vector3 endPosition
- The world position to end the linecast at.out RaycastHit hitData
- The linecast hit data.LayerMask ignoreLayers
- A layermask of layers to ignore from the linecast.QueryTriggerInteraction affectTriggers
- Determines the trigger interaction level of the cast.bool
- Returns true if the linecast successfully collides with a valid object.The Linecast method is used to generate a linecast either from the given CustomRaycast object or a default Physics.Linecast.
public static bool CapsuleCast(VRTK_CustomRaycast customCast, Vector3 point1, Vector3 point2, float radius, Vector3 direction, float maxDistance, out RaycastHit hitData, LayerMask ignoreLayers, QueryTriggerInteraction affectTriggers = QueryTriggerInteraction.UseGlobal)
VRTK_CustomRaycast customCast
- The optional object with customised cast parameters.Vector3 point1
- The center of the sphere at the start of the capsule.Vector3 point2
- The center of the sphere at the end of the capsule.float radius
- The radius of the capsule.Vector3 direction
- The direction into which to sweep the capsule.float maxDistance
- The max length of the sweep.out RaycastHit hitData
- The capsulecast hit data.LayerMask ignoreLayers
- A layermask of layers to ignore from the capsulecast.QueryTriggerInteraction affectTriggers
- Determines the trigger interaction level of the cast.bool
- Returns true if the capsulecast successfully collides with a valid object.The CapsuleCast method is used to generate a capsulecast either from the given CustomRaycast object or a default Physics.CapsuleCast.
public static bool BoxCast(VRTK_CustomRaycast customCast, Vector3 center, Vector3 halfExtents, Vector3 direction, Quaternion orientation, float maxDistance, out RaycastHit hitData, LayerMask ignoreLayers, QueryTriggerInteraction affectTriggers = QueryTriggerInteraction.UseGlobal)
VRTK_CustomRaycast customCast
- The optional object with customised cast parameters.Vector3 center
- The center of the box.Vector3 halfExtents
- Half the size of the box in each dimension.Vector3 direction
- The direction in which to cast the box.Quaternion orientation
- The rotation of the box.float maxDistance
- The max length of the cast.out RaycastHit hitData
- The boxcast hit data.LayerMask ignoreLayers
- A layermask of layers to ignore from the boxcast.QueryTriggerInteraction affectTriggers
- Determines the trigger interaction level of the cast.bool
- Returns true if the boxcast successfully collides with a valid object.The BoxCast method is used to generate a boxcast either from the given CustomRaycast object or a default Physics.BoxCast.
public virtual bool CustomRaycast(Ray ray, out RaycastHit hitData, float length = Mathf.Infinity)
Ray ray
- The Ray to cast with.out RaycastHit hitData
- The raycast hit data.float length
- The maximum length of the raycast.bool
- Returns true if the raycast successfully collides with a valid object.The CustomRaycast method is used to generate a raycast based on the options defined in the CustomRaycast object.
public virtual bool CustomLinecast(Vector3 startPosition, Vector3 endPosition, out RaycastHit hitData)
Vector3 startPosition
- The world position to start the linecast from.Vector3 endPosition
- The world position to end the linecast at.out RaycastHit hitData
- The linecast hit data.bool
- Returns true if the line successfully collides with a valid object.The CustomLinecast method is used to generate a linecast based on the options defined in the CustomRaycast object.
public virtual bool CustomCapsuleCast(Vector3 point1, Vector3 point2, float radius, Vector3 direction, float maxDistance, out RaycastHit hitData)
Vector3 point1
- The center of the sphere at the start of the capsule.Vector3 point2
- The center of the sphere at the end of the capsule.float radius
- The radius of the capsule.Vector3 direction
- The direction into which to sweep the capsule.float maxDistance
- The max length of the sweep.out RaycastHit hitData
- The capsulecast hit data.bool
- Returns true if the capsule successfully collides with a valid object.The CustomCapsuleCast method is used to generate a capsulecast based on the options defined in the CustomRaycast object.
public virtual bool CustomBoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, Quaternion orientation, float maxDistance, out RaycastHit hitData)
Vector3 center
- The center of the box.Vector3 halfExtents
- Half the size of the box in each dimension.Vector3 direction
- The direction in which to cast the box.Quaternion orientation
- The rotation of the box.float maxDistance
- The max length of the cast.out RaycastHit hitData
- The boxcast hit data.bool
- Returns true if the box successfully collides with a valid object.The CustomBoxCast method is used to generate a boxcast based on the options defined in the CustomRaycast object.
The Nav Mesh Data script allows custom nav mesh information to be provided to the teleporter script.
Adaptive Quality dynamically changes rendering settings to maintain VR framerate while maximizing GPU utilization.
Only Compatible With Unity 5.4 and above
There are two goals:
This script currently changes the following to reach these goals:
In the future it could be changed to also change the following:
Some shaders, especially Image Effects, need to be modified to work with the changed render scale. To fix them
pass 1.0f / VRSettings.renderViewportScale
into the shader and scale all incoming UV values with it in the vertex
program. Do this by using Material.SetFloat
to set the value in the script that configures the shader.
In more detail:
.shader
file: Add a new runtime-set property value float _InverseOfRenderViewportScale
and add vertexInput.texcoord *= _InverseOfRenderViewportScale
to the start of the vertex program.cs
file: Before using the material (eg. Graphics.Blit
) add material.SetFloat("_InverseOfRenderViewportScale", 1.0f / VRSettings.renderViewportScale)
VRDevice
, the box that is lit below in cyan represents the current resolution and the filled box represents the current viewport scale. The yellow boxes represent resolutions below the recommended render target resolution. The currently lit box becomes red whenever the user is likely seeing reprojection in the HMD since the application isn't maintaining VR framerate. If lit, the box all the way on the left is almost always lit red because it represents the lowest render scale with reprojection on.Shift+F1
: Toggle debug visualization on/offShift+F2
: Toggle usage of override render scale on/offShift+F3
: Decrease override render scale levelShift+F4
: Increase override render scale level-noaq
: Disable adaptive quality-aqminscale X
: Set minimum render scale to X-aqmaxscale X
: Set maximum render scale to X-aqmaxres X
: Set maximum render target dimension to X-aqfillratestep X
: Set render scale fill rate step size in percent to X (X from 1 to 100)-aqoverride X
: Set override render scale level to X-vrdebug
: Enable debug visualization-msaa X
: Set MSAA level to XVRDevice
.maximumRenderScale
.public readonly ReadOnlyCollection<float> renderScales
- All the calculated render scales. The elements of this collection are to be interpreted as modifiers to the recommended render target resolution provided by the current VRDevice
.public static float CurrentRenderScale
- The current render scale. A render scale of 1.0
represents the recommended render target resolution provided by the current VRDevice
.public Vector2 defaultRenderTargetResolution
- The recommended render target resolution provided by the current VRDevice
.public Vector2 currentRenderTargetResolution
- The current render target resolution.
public static Vector2 RenderTargetResolutionForRenderScale(float renderScale)
float renderScale
- The render scale to calculate the render target resolution with.Vector2
- The render target resolution for renderScale
.Calculates and returns the render target resolution for a given render scale.
public float BiggestAllowedMaximumRenderScale()
float
- The biggest allowed maximum render scale.Calculates and returns the biggest allowed maximum render scale to be used for maximumRenderScale
given the current maximumRenderTargetDimension
.
public override string ToString()
string
- The summary.A summary of this script by listing all the calculated render scales with their corresponding render target resolution.
VRTK/Examples/039_CameraRig_AdaptiveQuality
displays the frames per second in the centre of the headset view.
The debug visualization of this script is displayed near the top edge of the headset view.
Pressing the trigger generates a new sphere and pressing the touchpad generates ten new spheres.
Eventually when lots of spheres are present the FPS will drop and demonstrate the script.
Abstract class that allows to change one game object's properties to follow another game object.
gameObjectToFollow
.gameObjectToFollow
.gameObjectToFollow
.public Vector3 targetPosition { get private set }
- The position that results by following gameObjectToFollow
.public Quaternion targetRotation { get private set }
- The rotation that results by following gameObjectToFollow
.public Vector3 targetScale { get private set }
- The scale that results by following gameObjectToFollow
.
public virtual void Follow()
Follow gameObjectToFollow
using the current settings.
extends VRTK_ObjectFollow
Changes one GameObject's rigidbody to follow another GameObject's rigidbody.
Game Object To Change
Rigidbody can be from the Game Object To Follow
Rigidbody before the position is forcibly set to match the position.public enum MovementOption
- Specifies how to position and rotate the rigidbody.
Set
- Use Rigidbody.position and Rigidbody.rotation.Move
- Use Rigidbody.MovePosition and Rigidbody.MoveRotation.Add
- Use Rigidbody.AddForce(Vector3) and Rigidbody.AddTorque(Vector3).Track
- Use velocity and angular velocity with MoveTowards.
public override void Follow()
Follow gameObjectToFollow
using the current settings.
extends VRTK_ObjectFollow
Changes one GameObject's transform to follow another GameObject's transform.
public enum FollowMoment
- The moment at which to follow.
OnFixedUpdate
- Follow in the FixedUpdate method.OnUpdate
- Follow in the Update method.OnLateUpdate
- Follow in the LateUpdate method.OnPreRender
- Follow in the OnPreRender method. (This script doesn't have to be attached to a camera).OnPreCull
- Follow in the OnPreCull method. (This script doesn't have to be attached to a camera).
public override void Follow()
Follow gameObjectToFollow
using the current settings.
The GameObject that the SDK Object Alias script is applied to will become a child of the selected SDK Object.
public enum SDKObject
- Valid SDK Objects
Boundary
- The main camera rig/play area object that defines the player boundary.Headset
- The main headset camera defines the player head.extends VRTK_SDKControllerReady
The SDK Transform Modify can be used to change a transform orientation at runtime based on the currently used SDK or SDK controller.
public virtual void UpdateTransform(VRTK_ControllerReference controllerReference = null)
VRTK_ControllerReference controllerReference
- An optional reference to the controller to update the transform with.The UpdateTransform method updates the Transform data on the current GameObject for the specified settings.
public virtual void SetOrigins()
The SetOrigins method sets the original position, rotation, scale of the target Transform.
extends VRTK_SDKControllerReady
The SDK Object State script can be used to set the enable/active state of a GameObject or Component based on SDK information.
The state can be determined by:
Target
.Target
to when this script is enabled. Checking this box will enable/activate the Target
, unchecking will disable/deactivate the Target
.Target
state will be set to the desired Object State
.Target
state will be set to the desired Object State
.Target
state will be set to the desired Object State
.
public virtual void SetStateByControllerReference(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- A controller reference to check for the controller type of.The SetStateByControllerReference method sets the object state based on the controller type of the given controller reference.
extends VRTK_SDKControllerReady
Provides the ability to switch button mappings based on the current SDK or controller type
Script Usage:
VRTK_SDKInputOverride
script on any active scene GameObject.
public virtual void ForceManage()
The ForceManage method forces the inputs to be updated even without an SDK change event occuring.
The Velocity Estimator is used to calculate an estimated velocity on a moving object that is moving outside of Unity physics.
Objects that have rigidbodies and use Unity physics to move around will automatically provide accurate velocity and angular velocity information.
Any object that is moved around using absolute positions or moving the transform position will not be able to provide accurate velocity or angular velocity information. When the Velocity Estimator script is applied to any GameObject it will provide a best case estimation of what the object's velocity and angular velocity is based on a given number of position and rotation samples. The more samples used, the higher the precision but the script will be more demanding on processing time.
public virtual void StartEstimation()
The StartEstimation method begins logging samples of position and rotation for the GameObject.
public virtual void EndEstimation()
The EndEstimation method stops logging samples of position and rotation for the GameObject.
public virtual Vector3 GetVelocityEstimate()
Vector3
- The velocity estimate vector of the GameObjectThe GetVelocityEstimate method returns the current velocity estimate.
public virtual Vector3 GetAngularVelocityEstimate()
Vector3
- The angular velocity estimate vector of the GameObjectThe GetAngularVelocityEstimate method returns the current angular velocity estimate.
public virtual Vector3 GetAccelerationEstimate()
Vector3
- The acceleration estimate vector of the GameObjectThe GetAccelerationEstimate method returns the current acceleration estimate.
The base scripts used to determine the interface for interacting with a Unity VR SDK.
extends ScriptableObject
Abstract superclass that defines that a particular class is an SDK.
This is an abstract class to mark all different SDK endpoints with. This is used to allow for type safety when talking about 'an SDK' instead of one of the different endpoints (System, Boundaries, Headset, Controller).
public virtual void OnBeforeSetupLoad(VRTK_SDKSetup setup)
VRTK_SDKSetup setup
- The SDK Setup which is using this SDK.This method is called just before loading the VRTK_SDKSetup that's using this SDK.
public virtual void OnAfterSetupLoad(VRTK_SDKSetup setup)
VRTK_SDKSetup setup
- The SDK Setup which is using this SDK.This method is called just after loading the VRTK_SDKSetup that's using this SDK.
public virtual void OnBeforeSetupUnload(VRTK_SDKSetup setup)
VRTK_SDKSetup setup
- The SDK Setup which is using this SDK.This method is called just before unloading the VRTK_SDKSetup that's using this SDK.
public virtual void OnAfterSetupUnload(VRTK_SDKSetup setup)
VRTK_SDKSetup setup
- The SDK Setup which is using this SDK.This method is called just after unloading the VRTK_SDKSetup that's using this SDK.
extends Attribute
Describes a class that represents an SDK. Only allowed on classes that inherit from SDK_Base.
public readonly string prettyName
- The pretty name of the SDK. Uniquely identifies the SDK.public readonly string symbol
- The scripting define symbol needed for the SDK. Needs to be the same as SDK_ScriptingDefineSymbolPredicateAttribute.symbol
to add and remove the scripting define symbol automatically using VRTK_SDKManager.public readonly string vrDeviceName
- The name of the VR Device to load.public readonly int index
- The index of this attribute, in case there are multiple on the same target.public BuildTargetGroup buildTargetGroup
- The build target group this SDK is for.public bool describesFallbackSDK
- Whether this description describes a fallback SDK.
public SDK_DescriptionAttribute(string prettyName, string symbol, string vrDeviceName, string buildTargetGroupName, int index = 0)
string prettyName
- The pretty name of the SDK. Uniquely identifies the SDK. null
and string.Empty
aren't allowed.string symbol
- The scripting define symbol needed for the SDK. Needs to be the same as SDK_ScriptingDefineSymbolPredicateAttribute.symbol
to add and remove the scripting define symbol automatically using VRTK_SDKManager. null
and string.Empty
are allowed.string vrDeviceName
- The name of the VR Device to load. Set to null
or string.Empty
if no VR Device is needed.string buildTargetGroupName
- The name of a constant of BuildTargetGroup
. BuildTargetGroup.Unknown
, null
and string.Empty
are not allowed.int index
- The index of this attribute, in case there are multiple on the same target.Creates a new attribute.
public SDK_DescriptionAttribute(Type typeToCopyExistingDescriptionFrom, int index = 0)
Type typeToCopyExistingDescriptionFrom
- The type to copy the existing SDK_DescriptionAttribute from. null
is not allowed.int index
- The index of the description to copy from the the existing SDK_DescriptionAttribute.Creates a new attribute by copying from another attribute on a given type.
extends Attribute, ISerializationCallbackReceiver
Specifies a method to be used as a predicate to allow VRTK_SDKManager to automatically add and remove scripting define symbols. Only allowed on static methods that take no arguments and return a bool
.
public const string RemovableSymbolPrefix
- The prefix of scripting define symbols that must be used to be able to automatically remove the symbols. Default: "VRTK_DEFINE_"
public string symbol
- The scripting define symbol to conditionally add or remove.public BuildTargetGroup buildTargetGroup
- The build target group to use when conditionally adding or removing symbol.
public SDK_ScriptingDefineSymbolPredicateAttribute(string symbol, string buildTargetGroupName)
string symbol
- The scripting define symbol to conditionally add or remove. Needs to start with RemovableSymbolPrefix
to be able to automatically remove the symbol. null
and string.Empty
are not allowed.string buildTargetGroupName
- The name of a constant of BuildTargetGroup
. BuildTargetGroup.Unknown
, null
and string.Empty
are not allowed.Creates a new attribute.
public SDK_ScriptingDefineSymbolPredicateAttribute(SDK_ScriptingDefineSymbolPredicateAttribute attributeToCopy)
SDK_ScriptingDefineSymbolPredicateAttribute attributeToCopy
- The attribute to copy.Creates a new attribute by copying an existing one.
extends SDK_Base
The Base System SDK script provides a bridge to core system SDK methods.
This is an abstract class to implement the interface required by all implemented SDKs.
public abstract bool IsDisplayOnDesktop();
bool
- Returns true if the display is extending the desktopThe IsDisplayOnDesktop method returns true if the display is extending the desktop.
public abstract bool ShouldAppRenderWithLowResources();
bool
- Returns true if the Unity app should render with low resources.The ShouldAppRenderWithLowResources method is used to determine if the Unity app should use low resource mode. Typically true when the dashboard is showing.
public abstract void ForceInterleavedReprojectionOn(bool force);
bool force
- If true then Interleaved Reprojection will be forced on, if false it will not be forced on.The ForceInterleavedReprojectionOn method determines whether Interleaved Reprojection should be forced on or off.
extends SDK_Base
The Base Headset SDK script provides a bridge to SDK methods that deal with the VR Headset.
This is an abstract class to implement the interface required by all implemented SDKs.
public enum HeadsetType
- The connected headset type
Undefined
- The headset connected is unknown.Simulator
- The headset associated with the simulator.HTCVive
- The HTC Vive headset.OculusRiftDK1
- The Oculus Rift DK1 headset.OculusRiftDK2
- The Oculus Rift DK2 headset.OculusRift
- The Oculus Rift headset.OculusGearVR
- The Oculus GearVR headset.GoogleDaydream
- The Google Daydream headset.GoogleCardboard
- The Google Cardboard headset.HyperealVR
- The HyperealVR headset.WindowsMixedReality
- The Windows Mixed Reality headset.
public abstract void ProcessUpdate(Dictionary<string, object> options);
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public abstract void ProcessFixedUpdate(Dictionary<string, object> options);
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public abstract Transform GetHeadset();
Transform
- A transform of the object representing the headset in the scene.The GetHeadset method returns the Transform of the object that is used to represent the headset in the scene.
public abstract Transform GetHeadsetCamera();
Transform
- A transform of the object holding the headset camera in the scene.The GetHeadsetCamera method returns the Transform of the object that is used to hold the headset camera in the scene.
public abstract string GetHeadsetType();
string
- The string of the headset connected.The GetHeadsetType method returns a string representing the type of headset connected.
public abstract Vector3 GetHeadsetVelocity();
Vector3
- A Vector3 containing the current velocity of the headset.The GetHeadsetVelocity method is used to determine the current velocity of the headset.
public abstract Vector3 GetHeadsetAngularVelocity();
Vector3
- A Vector3 containing the current angular velocity of the headset.The GetHeadsetAngularVelocity method is used to determine the current angular velocity of the headset.
public abstract void HeadsetFade(Color color, float duration, bool fadeOverlay = false);
Color color
- The colour to fade to.float duration
- The amount of time the fade should take to reach the given colour.bool fadeOverlay
- Determines whether to use an overlay on the fade.The HeadsetFade method is used to apply a fade to the headset camera to progressively change the colour.
public abstract bool HasHeadsetFade(Transform obj);
Transform obj
- The Transform to check to see if a camera fade is available on.bool
- Returns true if the headset has fade functionality on it.The HasHeadsetFade method checks to see if the given game object (usually the camera) has the ability to fade the viewpoint.
public abstract void AddHeadsetFade(Transform camera);
Transform camera
- The Transform to with the camera on to add the fade functionality to.The AddHeadsetFade method attempts to add the fade functionality to the game object with the camera on it.
extends SDK_Base
The Base Controller SDK script provides a bridge to SDK methods that deal with the input devices.
This is an abstract class to implement the interface required by all implemented SDKs.
public enum ButtonTypes
- Types of buttons on a controller
ButtonOne
- Button One on the controller.ButtonTwo
- Button Two on the controller.Grip
- Grip on the controller.GripHairline
- Grip Hairline on the controller.StartMenu
- Start Menu on the controller.Trigger
- Trigger on the controller.TriggerHairline
- Trigger Hairline on the controller.Touchpad
- Touchpad on the controller.TouchpadTwo
- Touchpad Two on the controller.MiddleFinger
- Middle Finger on the controller.RingFinger
- Ring Finger on the controller.PinkyFinger
- Pinky Finger on the controller.public enum ButtonPressTypes
- Concepts of controller button press
Press
- The button is currently being pressed.PressDown
- The button has just been pressed down.PressUp
- The button has just been released.Touch
- The button is currently being touched.TouchDown
- The button has just been touched.TouchUp
- The button is no longer being touched.public enum ControllerElements
- The elements of a generic controller
AttachPoint
- The default point on the controller to attach grabbed objects to.Trigger
- The trigger button.GripLeft
- The left part of the grip button collection.GripRight
- The right part of the grip button collection.Touchpad
- The touch pad/stick.ButtonOne
- The first generic button.ButtonTwo
- The second generic button.SystemMenu
- The system menu button.Body
- The encompassing mesh of the controller body.StartMenu
- The start menu button.TouchpadTwo
- The touch pad/stick two.public enum ControllerHand
- Controller hand reference.
None
- No hand is assigned.Left
- The left hand is assigned.Right
- The right hand is assigned.public enum ControllerType
- SDK Controller types.
Undefined
- No controller type.Custom
- A custom controller type.Simulator_Hand
- The Simulator default hand controller.SteamVR_ViveWand
- The HTC Vive wand controller for SteamVR.SteamVR_OculusTouch
- The Oculus Touch controller for SteamVR.Oculus_OculusTouch
- The Oculus Touch controller for Oculus Utilities.Daydream_Controller
- The Daydream controller for Google Daydream SDK.Ximmerse_Flip
- The Flip controller for Ximmerse SDK.SteamVR_ValveKnuckles
- The Valve Knuckles controller for SteamVR.Oculus_OculusGamepad
- The Oculus Gamepad for Oculus Utilities.Oculus_OculusRemote
- The Oculus Remote for Oculus Utilities.Oculus_GearVRHMD
- The Oculus GearVR HMD controls for Oculus Utilities.Oculus_GearVRController
- The Oculus GearVR controller for Oculus Utilities.WindowsMR_MotionController
- The Windows Mixed Reality Motion Controller for Windows Mixed Reality.SteamVR_WindowsMRController
- The Windows Mixed Reality Motion Controller for SteamVR.
public abstract void ProcessUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options);
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public abstract void ProcessFixedUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options);
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public abstract ControllerType GetCurrentControllerType(VRTK_ControllerReference controllerReference = null);
VRTK_ControllerReference controllerReference
- The reference to the controller to get type of.ControllerType
- The ControllerType based on the SDK and headset being used.The GetCurrentControllerType method returns the current used ControllerType based on the SDK and headset being used.
public abstract string GetControllerDefaultColliderPath(ControllerHand hand);
ControllerHand hand
- The controller hand to check forstring
- A path to the resource that contains the collider GameObject.The GetControllerDefaultColliderPath returns the path to the prefab that contains the collider objects for the default controller of this SDK.
public abstract string GetControllerElementPath(ControllerElements element, ControllerHand hand, bool fullPath = false);
ControllerElements element
- The controller element to look up.ControllerHand hand
- The controller hand to look up.bool fullPath
- Whether to get the initial path or the full path to the element.string
- A string containing the path to the game object that the controller element resides in.The GetControllerElementPath returns the path to the game object that the given controller element for the given hand resides in.
public abstract uint GetControllerIndex(GameObject controller);
GameObject controller
- The GameObject containing the controller.uint
- The index of the given controller.The GetControllerIndex method returns the index of the given controller.
public abstract GameObject GetControllerByIndex(uint index, bool actual = false);
uint index
- The index of the controller to find.bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject of the controllerThe GetControllerByIndex method returns the GameObject of a controller with a specific index.
public abstract Transform GetControllerOrigin(VRTK_ControllerReference controllerReference);
VRTK_ControllerReference controllerReference
- The reference to the controller to retrieve the origin from.Transform
- A Transform containing the origin of the controller.The GetControllerOrigin method returns the origin of the given controller.
public abstract GameObject GetControllerLeftHand(bool actual = false);
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the left hand controller.The GetControllerLeftHand method returns the GameObject containing the representation of the left hand controller.
public abstract GameObject GetControllerRightHand(bool actual = false);
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the right hand controller.The GetControllerRightHand method returns the GameObject containing the representation of the right hand controller.
public abstract bool IsControllerLeftHand(GameObject controller);
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/1 method is used to check if the given controller is the the left hand controller.
public abstract bool IsControllerRightHand(GameObject controller);
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/1 method is used to check if the given controller is the the right hand controller.
public abstract bool IsControllerLeftHand(GameObject controller, bool actual);
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/2 method is used to check if the given controller is the the left hand controller.
public abstract bool IsControllerRightHand(GameObject controller, bool actual);
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/2 method is used to check if the given controller is the the right hand controller.
public abstract bool WaitForControllerModel(ControllerHand hand);
ControllerHand hand
- The hand to determine if the controller model will be ready for.bool
- Returns true if the controller model requires loading in at runtime and therefore needs waiting for. Returns false if the controller model will be available at start.The WaitForControllerModel method determines whether the controller model for the given hand requires waiting to load in on scene start.
public abstract GameObject GetControllerModel(GameObject controller);
GameObject controller
- The GameObject to get the model alias for.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given GameObject.
public abstract GameObject GetControllerModel(ControllerHand hand);
ControllerHand hand
- The hand enum of which controller model to retrieve.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given controller hand.
public virtual ControllerHand GetControllerModelHand(GameObject controllerModel)
GameObject controllerModel
- The controller model GameObject to get the hand for.ControllerHand
- The hand enum for which the given controller model is for.The GetControllerModelHand method returns the hand for the given controller model GameObject.
public abstract GameObject GetControllerRenderModel(VRTK_ControllerReference controllerReference);
VRTK_ControllerReference controllerReference
- The reference to the controller to check.GameObject
- A GameObject containing the object that has a render model for the controller.The GetControllerRenderModel method gets the game object that contains the given controller's render model.
public abstract void SetControllerRenderModelWheel(GameObject renderModel, bool state);
GameObject renderModel
- The GameObject containing the controller render model.bool state
- If true and the render model has a scroll wheen then it will be displayed, if false then the scroll wheel will be hidden.The SetControllerRenderModelWheel method sets the state of the scroll wheel on the controller render model.
public abstract void HapticPulse(VRTK_ControllerReference controllerReference, float strength = 0.5f);
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.float strength
- The intensity of the rumble of the controller motor. 0
to 1
.The HapticPulse/2 method is used to initiate a simple haptic pulse on the tracked object of the given controller reference.
public abstract bool HapticPulse(VRTK_ControllerReference controllerReference, AudioClip clip);
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.AudioClip clip
- The audio clip to use for the haptic pattern.The HapticPulse/2 method is used to initiate a haptic pulse based on an audio clip on the tracked object of the given controller reference.
public abstract SDK_ControllerHapticModifiers GetHapticModifiers();
SDK_ControllerHapticModifiers
- An SDK_ControllerHapticModifiers object with a given durationModifier
and an intervalModifier
.The GetHapticModifiers method is used to return modifiers for the duration and interval if the SDK handles it slightly differently.
public abstract Vector3 GetVelocity(VRTK_ControllerReference controllerReference);
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current velocity of the tracked object.The GetVelocity method is used to determine the current velocity of the tracked object on the given controller reference.
public abstract Vector3 GetAngularVelocity(VRTK_ControllerReference controllerReference);
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current angular velocity of the tracked object.The GetAngularVelocity method is used to determine the current angular velocity of the tracked object on the given controller reference.
public abstract bool IsTouchpadStatic(bool isTouched, Vector2 currentAxisValues, Vector2 previousAxisValues, int compareFidelity);
Vector2 currentAxisValues
-Vector2 previousAxisValues
-int compareFidelity
-bool
- Returns true if the touchpad is not currently being touched or moved.The IsTouchpadStatic method is used to determine if the touchpad is currently not being moved.
public abstract Vector2 GetButtonAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference);
ButtonTypes buttonType
- The type of button to check for the axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button axis on.Vector2
- A Vector2 of the X/Y values of the button axis. If no axis values exist for the given button, then a Vector2.Zero is returned.The GetButtonAxis method retrieves the current X/Y axis values for the given button type on the given controller reference.
public abstract float GetButtonSenseAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference);
ButtonTypes buttonType
- The type of button to check for the sense axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the sense axis on.float
- The current sense axis value.The GetButtonSenseAxis method retrieves the current sense axis value for the given button type on the given controller reference.
public abstract float GetButtonHairlineDelta(ButtonTypes buttonType, VRTK_ControllerReference controllerReference);
ButtonTypes buttonType
- The type of button to get the hairline delta for.VRTK_ControllerReference controllerReference
- The reference to the controller to get the hairline delta for.float
- The delta between the button presses.The GetButtonHairlineDelta method is used to get the difference between the current button press and the previous frame button press.
public abstract bool GetControllerButtonState(ButtonTypes buttonType, ButtonPressTypes pressType, VRTK_ControllerReference controllerReference);
ButtonTypes buttonType
- The type of button to check for the state of.ButtonPressTypes pressType
- The button state to check for.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button state on.bool
- Returns true if the given button is in the state of the given press type on the given controller reference.The GetControllerButtonState method is used to determine if the given controller button for the given press type on the given controller reference is currently taking place.
extends SDK_Base
The Base Boundaries SDK script provides a bridge to SDK methods that deal with the play area of SDKs that support room scale play spaces.
This is an abstract class to implement the interface required by all implemented SDKs.
public abstract void InitBoundaries();
The InitBoundaries method is run on start of scene and can be used to initialse anything on game start.
public abstract Transform GetPlayArea();
Transform
- A transform of the object representing the play area in the scene.The GetPlayArea method returns the Transform of the object that is used to represent the play area in the scene.
public abstract Vector3[] GetPlayAreaVertices();
Vector3[]
- A Vector3 array of the points in the scene that represent the play area boundaries.The GetPlayAreaVertices method returns the points of the play area boundaries.
public abstract float GetPlayAreaBorderThickness();
float
- The thickness of the drawn border.The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
public abstract bool IsPlayAreaSizeCalibrated();
bool
- Returns true if the play area size has been auto calibrated and set by external sensors.The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
public abstract bool GetDrawAtRuntime();
bool
- Returns true if the drawn border is being displayed.The GetDrawAtRuntime method returns whether the given play area drawn border is being displayed.
public abstract void SetDrawAtRuntime(bool value);
bool value
- The state of whether the drawn border should be displayed or not.The SetDrawAtRuntime method sets whether the given play area drawn border should be displayed at runtime.
The scripts used to provide a default/null fallback for any implemented SDK.
extends SDK_BaseSystem
The Fallback System SDK script provides a fallback collection of methods that return null or default system values.
This is the fallback class that will just return default values.
public override bool IsDisplayOnDesktop()
bool
- Returns true if the display is extending the desktopThe IsDisplayOnDesktop method returns true if the display is extending the desktop.
public override bool ShouldAppRenderWithLowResources()
bool
- Returns true if the Unity app should render with low resources.The ShouldAppRenderWithLowResources method is used to determine if the Unity app should use low resource mode. Typically true when the dashboard is showing.
public override void ForceInterleavedReprojectionOn(bool force)
bool force
- If true then Interleaved Reprojection will be forced on, if false it will not be forced on.The ForceInterleavedReprojectionOn method determines whether Interleaved Reprojection should be forced on or off.
extends SDK_BaseHeadset
The Fallback Headset SDK script provides a fallback collection of methods that return null or default headset values.
This is the fallback class that will just return default values.
public override void ProcessUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void ProcessFixedUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override Transform GetHeadset()
Transform
- A transform of the object representing the headset in the scene.The GetHeadset method returns the Transform of the object that is used to represent the headset in the scene.
public override Transform GetHeadsetCamera()
Transform
- A transform of the object holding the headset camera in the scene.The GetHeadsetCamera method returns the Transform of the object that is used to hold the headset camera in the scene.
public override string GetHeadsetType()
string
- The string of the headset connected.The GetHeadsetType method returns a string representing the type of headset connected.
public override Vector3 GetHeadsetVelocity()
Vector3
- A Vector3 containing the current velocity of the headset.The GetHeadsetVelocity method is used to determine the current velocity of the headset.
public override Vector3 GetHeadsetAngularVelocity()
Vector3
- A Vector3 containing the current angular velocity of the headset.The GetHeadsetAngularVelocity method is used to determine the current angular velocity of the headset.
public override void HeadsetFade(Color color, float duration, bool fadeOverlay = false)
Color color
- The colour to fade to.float duration
- The amount of time the fade should take to reach the given colour.bool fadeOverlay
- Determines whether to use an overlay on the fade.The HeadsetFade method is used to apply a fade to the headset camera to progressively change the colour.
public override bool HasHeadsetFade(Transform obj)
Transform obj
- The Transform to check to see if a camera fade is available on.bool
- Returns true if the headset has fade functionality on it.The HasHeadsetFade method checks to see if the given game object (usually the camera) has the ability to fade the viewpoint.
public override void AddHeadsetFade(Transform camera)
Transform camera
- The Transform to with the camera on to add the fade functionality to.The AddHeadsetFade method attempts to add the fade functionality to the game object with the camera on it.
extends SDK_BaseController
The Fallback Controller SDK script provides a fallback collection of methods that return null or default headset values.
This is the fallback class that will just return default values.
public override void ProcessUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void ProcessFixedUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override ControllerType GetCurrentControllerType(VRTK_ControllerReference controllerReference = null)
VRTK_ControllerReference controllerReference
- The reference to the controller to get type of.ControllerType
- The ControllerType based on the SDK and headset being used.The GetCurrentControllerType method returns the current used ControllerType based on the SDK and headset being used.
public override string GetControllerDefaultColliderPath(ControllerHand hand)
ControllerHand hand
- The controller hand to check forstring
- A path to the resource that contains the collider GameObject.The GetControllerDefaultColliderPath returns the path to the prefab that contains the collider objects for the default controller of this SDK.
public override string GetControllerElementPath(ControllerElements element, ControllerHand hand, bool fullPath = false)
ControllerElements element
- The controller element to look up.ControllerHand hand
- The controller hand to look up.bool fullPath
- Whether to get the initial path or the full path to the element.string
- A string containing the path to the game object that the controller element resides in.The GetControllerElementPath returns the path to the game object that the given controller element for the given hand resides in.
public override uint GetControllerIndex(GameObject controller)
GameObject controller
- The GameObject containing the controller.uint
- The index of the given controller.The GetControllerIndex method returns the index of the given controller.
public override GameObject GetControllerByIndex(uint index, bool actual = false)
uint index
- The index of the controller to find.bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject of the controllerThe GetControllerByIndex method returns the GameObject of a controller with a specific index.
public override Transform GetControllerOrigin(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to retrieve the origin from.Transform
- A Transform containing the origin of the controller.The GetControllerOrigin method returns the origin of the given controller.
public override GameObject GetControllerLeftHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the left hand controller.The GetControllerLeftHand method returns the GameObject containing the representation of the left hand controller.
public override GameObject GetControllerRightHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the right hand controller.The GetControllerRightHand method returns the GameObject containing the representation of the right hand controller.
public override bool IsControllerLeftHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/1 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/1 method is used to check if the given controller is the the right hand controller.
public override bool IsControllerLeftHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/2 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/2 method is used to check if the given controller is the the right hand controller.
public override bool WaitForControllerModel(ControllerHand hand)
ControllerHand hand
- The hand to determine if the controller model will be ready for.bool
- Returns true if the controller model requires loading in at runtime and therefore needs waiting for. Returns false if the controller model will be available at start.The WaitForControllerModel method determines whether the controller model for the given hand requires waiting to load in on scene start.
public override GameObject GetControllerModel(GameObject controller)
GameObject controller
- The GameObject to get the model alias for.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given GameObject.
public override GameObject GetControllerModel(ControllerHand hand)
ControllerHand hand
- The hand enum of which controller model to retrieve.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given controller hand.
public override GameObject GetControllerRenderModel(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to check.GameObject
- A GameObject containing the object that has a render model for the controller.The GetControllerRenderModel method gets the game object that contains the given controller's render model.
public override void SetControllerRenderModelWheel(GameObject renderModel, bool state)
GameObject renderModel
- The GameObject containing the controller render model.bool state
- If true and the render model has a scroll wheen then it will be displayed, if false then the scroll wheel will be hidden.The SetControllerRenderModelWheel method sets the state of the scroll wheel on the controller render model.
public override void HapticPulse(VRTK_ControllerReference controllerReference, float strength = 0.5f)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.float strength
- The intensity of the rumble of the controller motor. 0
to 1
.The HapticPulse/2 method is used to initiate a simple haptic pulse on the tracked object of the given controller reference.
public override bool HapticPulse(VRTK_ControllerReference controllerReference, AudioClip clip)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.AudioClip clip
- The audio clip to use for the haptic pattern.The HapticPulse/2 method is used to initiate a haptic pulse based on an audio clip on the tracked object of the given controller reference.
public override SDK_ControllerHapticModifiers GetHapticModifiers()
SDK_ControllerHapticModifiers
- An SDK_ControllerHapticModifiers object with a given durationModifier
and an intervalModifier
.The GetHapticModifiers method is used to return modifiers for the duration and interval if the SDK handles it slightly differently.
public override Vector3 GetVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current velocity of the tracked object.The GetVelocity method is used to determine the current velocity of the tracked object on the given controller reference.
public override Vector3 GetAngularVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current angular velocity of the tracked object.The GetAngularVelocity method is used to determine the current angular velocity of the tracked object on the given controller reference.
public override bool IsTouchpadStatic(bool isTouched, Vector2 currentAxisValues, Vector2 previousAxisValues, int compareFidelity)
Vector2 currentAxisValues
-Vector2 previousAxisValues
-int compareFidelity
-bool
- Returns true if the touchpad is not currently being touched or moved.The IsTouchpadStatic method is used to determine if the touchpad is currently not being moved.
public override Vector2 GetButtonAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button axis on.Vector2
- A Vector2 of the X/Y values of the button axis. If no axis values exist for the given button, then a Vector2.Zero is returned.The GetButtonAxis method retrieves the current X/Y axis values for the given button type on the given controller reference.
public override float GetButtonSenseAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the sense axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the sense axis on.float
- The current sense axis value.The GetButtonSenseAxis method retrieves the current sense axis value for the given button type on the given controller reference.
public override float GetButtonHairlineDelta(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to get the hairline delta for.VRTK_ControllerReference controllerReference
- The reference to the controller to get the hairline delta for.float
- The delta between the button presses.The GetButtonHairlineDelta method is used to get the difference between the current button press and the previous frame button press.
public override bool GetControllerButtonState(ButtonTypes buttonType, ButtonPressTypes pressType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the state of.ButtonPressTypes pressType
- The button state to check for.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button state on.bool
- Returns true if the given button is in the state of the given press type on the given controller reference.The GetControllerButtonState method is used to determine if the given controller button for the given press type on the given controller reference is currently taking place.
extends SDK_BaseBoundaries
The Fallback Boundaries SDK script provides a fallback collection of methods that return null or default headset values.
This is the fallback class that will just return default values.
public override void InitBoundaries()
The InitBoundaries method is run on start of scene and can be used to initialse anything on game start.
public override Transform GetPlayArea()
Transform
- A transform of the object representing the play area in the scene.The GetPlayArea method returns the Transform of the object that is used to represent the play area in the scene.
public override Vector3[] GetPlayAreaVertices()
Vector3[]
- A Vector3 array of the points in the scene that represent the play area boundaries.The GetPlayAreaVertices method returns the points of the play area boundaries.
public override float GetPlayAreaBorderThickness()
float
- The thickness of the drawn border.The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
public override bool IsPlayAreaSizeCalibrated()
bool
- Returns true if the play area size has been auto calibrated and set by external sensors.The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
public override bool GetDrawAtRuntime()
bool
- Returns true if the drawn border is being displayed.The GetDrawAtRuntime method returns whether the given play area drawn border is being displayed.
public override void SetDrawAtRuntime(bool value)
bool value
- The state of whether the drawn border should be displayed or not.The SetDrawAtRuntime method sets whether the given play area drawn border should be displayed at runtime.
The scripts used to utilise the built in UnityEngine.VR SDK.
extends SDK_BaseSystem
The Unity System SDK script provides a bridge to the Unity SDK.
public override bool IsDisplayOnDesktop()
bool
- Returns true if the display is extending the desktopThe IsDisplayOnDesktop method returns true if the display is extending the desktop.
public override bool ShouldAppRenderWithLowResources()
bool
- Returns true if the Unity app should render with low resources.The ShouldAppRenderWithLowResources method is used to determine if the Unity app should use low resource mode. Typically true when the dashboard is showing.
public override void ForceInterleavedReprojectionOn(bool force)
bool force
- If true then Interleaved Reprojection will be forced on, if false it will not be forced on.The ForceInterleavedReprojectionOn method determines whether Interleaved Reprojection should be forced on or off.
extends SDK_BaseHeadset
The Unity Headset SDK script provides a bridge to the base Unity headset support.
public override void ProcessUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void ProcessFixedUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override Transform GetHeadset()
Transform
- A transform of the object representing the headset in the scene.The GetHeadset method returns the Transform of the object that is used to represent the headset in the scene.
public override Transform GetHeadsetCamera()
Transform
- A transform of the object holding the headset camera in the scene.The GetHeadsetCamera method returns the Transform of the object that is used to hold the headset camera in the scene.
public override string GetHeadsetType()
string
- The string of the headset connected.The GetHeadsetType method returns a string representing the type of headset connected.
public override Vector3 GetHeadsetVelocity()
Vector3
- A Vector3 containing the current velocity of the headset.The GetHeadsetVelocity method is used to determine the current velocity of the headset.
public override Vector3 GetHeadsetAngularVelocity()
Vector3
- A Vector3 containing the current angular velocity of the headset.The GetHeadsetAngularVelocity method is used to determine the current angular velocity of the headset.
public override void HeadsetFade(Color color, float duration, bool fadeOverlay = false)
Color color
- The colour to fade to.float duration
- The amount of time the fade should take to reach the given colour.bool fadeOverlay
- Determines whether to use an overlay on the fade.The HeadsetFade method is used to apply a fade to the headset camera to progressively change the colour.
public override bool HasHeadsetFade(Transform obj)
Transform obj
- The Transform to check to see if a camera fade is available on.bool
- Returns true if the headset has fade functionality on it.The HasHeadsetFade method checks to see if the given game object (usually the camera) has the ability to fade the viewpoint.
public override void AddHeadsetFade(Transform camera)
Transform camera
- The Transform to with the camera on to add the fade functionality to.The AddHeadsetFade method attempts to add the fade functionality to the game object with the camera on it.
extends SDK_BaseController
The Unity Controller SDK script provides a bridge to the base Unity input device support.
public override void ProcessUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void ProcessFixedUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override ControllerType GetCurrentControllerType(VRTK_ControllerReference controllerReference = null)
VRTK_ControllerReference controllerReference
- The reference to the controller to get type of.ControllerType
- The ControllerType based on the SDK and headset being used.The GetCurrentControllerType method returns the current used ControllerType based on the SDK and headset being used.
public override string GetControllerDefaultColliderPath(ControllerHand hand)
ControllerHand hand
- The controller hand to check forstring
- A path to the resource that contains the collider GameObject.The GetControllerDefaultColliderPath returns the path to the prefab that contains the collider objects for the default controller of this SDK.
public override string GetControllerElementPath(ControllerElements element, ControllerHand hand, bool fullPath = false)
ControllerElements element
- The controller element to look up.ControllerHand hand
- The controller hand to look up.bool fullPath
- Whether to get the initial path or the full path to the element.string
- A string containing the path to the game object that the controller element resides in.The GetControllerElementPath returns the path to the game object that the given controller element for the given hand resides in.
public override uint GetControllerIndex(GameObject controller)
GameObject controller
- The GameObject containing the controller.uint
- The index of the given controller.The GetControllerIndex method returns the index of the given controller.
public override GameObject GetControllerByIndex(uint index, bool actual = false)
uint index
- The index of the controller to find.bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject of the controllerThe GetControllerByIndex method returns the GameObject of a controller with a specific index.
public override Transform GetControllerOrigin(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to retrieve the origin from.Transform
- A Transform containing the origin of the controller.The GetControllerOrigin method returns the origin of the given controller.
public override GameObject GetControllerLeftHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the left hand controller.The GetControllerLeftHand method returns the GameObject containing the representation of the left hand controller.
public override GameObject GetControllerRightHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the right hand controller.The GetControllerRightHand method returns the GameObject containing the representation of the right hand controller.
public override bool IsControllerLeftHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/1 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/1 method is used to check if the given controller is the the right hand controller.
public override bool IsControllerLeftHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/2 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/2 method is used to check if the given controller is the the right hand controller.
public override bool WaitForControllerModel(ControllerHand hand)
ControllerHand hand
- The hand to determine if the controller model will be ready for.bool
- Returns true if the controller model requires loading in at runtime and therefore needs waiting for. Returns false if the controller model will be available at start.The WaitForControllerModel method determines whether the controller model for the given hand requires waiting to load in on scene start.
public override GameObject GetControllerModel(GameObject controller)
GameObject controller
- The GameObject to get the model alias for.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given GameObject.
public override GameObject GetControllerModel(ControllerHand hand)
ControllerHand hand
- The hand enum of which controller model to retrieve.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given controller hand.
public override GameObject GetControllerRenderModel(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to check.GameObject
- A GameObject containing the object that has a render model for the controller.The GetControllerRenderModel method gets the game object that contains the given controller's render model.
public override void SetControllerRenderModelWheel(GameObject renderModel, bool state)
GameObject renderModel
- The GameObject containing the controller render model.bool state
- If true and the render model has a scroll wheen then it will be displayed, if false then the scroll wheel will be hidden.The SetControllerRenderModelWheel method sets the state of the scroll wheel on the controller render model.
public override void HapticPulse(VRTK_ControllerReference controllerReference, float strength = 0.5f)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.float strength
- The intensity of the rumble of the controller motor. 0
to 1
.The HapticPulse/2 method is used to initiate a simple haptic pulse on the tracked object of the given controller reference.
public override bool HapticPulse(VRTK_ControllerReference controllerReference, AudioClip clip)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.AudioClip clip
- The audio clip to use for the haptic pattern.The HapticPulse/2 method is used to initiate a haptic pulse based on an audio clip on the tracked object of the given controller reference.
public override SDK_ControllerHapticModifiers GetHapticModifiers()
SDK_ControllerHapticModifiers
- An SDK_ControllerHapticModifiers object with a given durationModifier
and an intervalModifier
.The GetHapticModifiers method is used to return modifiers for the duration and interval if the SDK handles it slightly differently.
public override Vector3 GetVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current velocity of the tracked object.The GetVelocity method is used to determine the current velocity of the tracked object on the given controller reference.
public override Vector3 GetAngularVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current angular velocity of the tracked object.The GetAngularVelocity method is used to determine the current angular velocity of the tracked object on the given controller reference.
public override bool IsTouchpadStatic(bool isTouched, Vector2 currentAxisValues, Vector2 previousAxisValues, int compareFidelity)
Vector2 currentAxisValues
-Vector2 previousAxisValues
-int compareFidelity
-bool
- Returns true if the touchpad is not currently being touched or moved.The IsTouchpadStatic method is used to determine if the touchpad is currently not being moved.
public override Vector2 GetButtonAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button axis on.Vector2
- A Vector2 of the X/Y values of the button axis. If no axis values exist for the given button, then a Vector2.Zero is returned.The GetButtonAxis method retrieves the current X/Y axis values for the given button type on the given controller reference.
public override float GetButtonSenseAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the sense axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the sense axis on.float
- The current sense axis value.The GetButtonSenseAxis method retrieves the current sense axis value for the given button type on the given controller reference.
public override float GetButtonHairlineDelta(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to get the hairline delta for.VRTK_ControllerReference controllerReference
- The reference to the controller to get the hairline delta for.float
- The delta between the button presses.The GetButtonHairlineDelta method is used to get the difference between the current button press and the previous frame button press.
public override bool GetControllerButtonState(ButtonTypes buttonType, ButtonPressTypes pressType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the state of.ButtonPressTypes pressType
- The button state to check for.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button state on.bool
- Returns true if the given button is in the state of the given press type on the given controller reference.The GetControllerButtonState method is used to determine if the given controller button for the given press type on the given controller reference is currently taking place.
extends SDK_BaseBoundaries
The Unity Boundaries SDK script provides a bridge to a default Unity play area.
public override void InitBoundaries()
The InitBoundaries method is run on start of scene and can be used to initialse anything on game start.
public override Transform GetPlayArea()
Transform
- A transform of the object representing the play area in the scene.The GetPlayArea method returns the Transform of the object that is used to represent the play area in the scene.
public override Vector3[] GetPlayAreaVertices()
Vector3[]
- A Vector3 array of the points in the scene that represent the play area boundaries.The GetPlayAreaVertices method returns the points of the play area boundaries.
public override float GetPlayAreaBorderThickness()
float
- The thickness of the drawn border.The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
public override bool IsPlayAreaSizeCalibrated()
bool
- Returns true if the play area size has been auto calibrated and set by external sensors.The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
public override bool GetDrawAtRuntime()
bool
- Returns true if the drawn border is being displayed.The GetDrawAtRuntime method returns whether the given play area drawn border is being displayed.
public override void SetDrawAtRuntime(bool value)
bool value
- The state of whether the drawn border should be displayed or not.The SetDrawAtRuntime method sets whether the given play area drawn border should be displayed at runtime.
The Controller Tracker enables the GameObject to track it's position/rotation to the available connected VR Controller via the UnityEngine.VR
library.
The Unity Controller Tracker is attached to the [UnityBase_CameraRig]
prefab on the child LeftHandAnchor
and RightHandAnchor
to enable controller tracking.
The Headset Tracker enables the GameObject to track it's position/rotation to the available connected VR HMD via the UnityEngine.VR
library.
The Unity Headset Tracker is attached to the [UnityBase_CameraRig]
prefab on the child Head
HMD tracking.
The scripts used to utilise the VR Simulator to build without VR Hardware.
extends SDK_BaseSystem
The Sim System SDK script provides dummy functions for system functions.
public override bool IsDisplayOnDesktop()
bool
- Returns true if the display is extending the desktopThe IsDisplayOnDesktop method returns true if the display is extending the desktop.
public override bool ShouldAppRenderWithLowResources()
bool
- Returns true if the Unity app should render with low resources.The ShouldAppRenderWithLowResources method is used to determine if the Unity app should use low resource mode. Typically true when the dashboard is showing.
public override void ForceInterleavedReprojectionOn(bool force)
bool force
- If true then Interleaved Reprojection will be forced on, if false it will not be forced on.The ForceInterleavedReprojectionOn method determines whether Interleaved Reprojection should be forced on or off.
extends SDK_BaseHeadset
The Sim Headset SDK script provides dummy functions for the headset.
public override void ProcessUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void ProcessFixedUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override Transform GetHeadset()
Transform
- A transform of the object representing the headset in the scene.The GetHeadset method returns the Transform of the object that is used to represent the headset in the scene.
public override Transform GetHeadsetCamera()
Transform
- A transform of the object holding the headset camera in the scene.The GetHeadsetCamera/0 method returns the Transform of the object that is used to hold the headset camera in the scene.
public override string GetHeadsetType()
string
- The string of the headset connected.The GetHeadsetType method returns a string representing the type of headset connected.
public override Vector3 GetHeadsetVelocity()
Vector3
- A Vector3 containing the current velocity of the headset.The GetHeadsetVelocity method is used to determine the current velocity of the headset.
public override Vector3 GetHeadsetAngularVelocity()
Vector3
- A Vector3 containing the current angular velocity of the headset.The GetHeadsetAngularVelocity method is used to determine the current angular velocity of the headset.
public override void HeadsetFade(Color color, float duration, bool fadeOverlay = false)
Color color
- The colour to fade to.float duration
- The amount of time the fade should take to reach the given colour.bool fadeOverlay
- Determines whether to use an overlay on the fade.The HeadsetFade method is used to apply a fade to the headset camera to progressively change the colour.
public override bool HasHeadsetFade(Transform obj)
Transform obj
- The Transform to check to see if a camera fade is available on.bool
- Returns true if the headset has fade functionality on it.The HasHeadsetFade method checks to see if the given game object (usually the camera) has the ability to fade the viewpoint.
public override void AddHeadsetFade(Transform camera)
Transform camera
- The Transform to with the camera on to add the fade functionality to.The AddHeadsetFade method attempts to add the fade functionality to the game object with the camera on it.
extends SDK_BaseController
The Sim Controller SDK script provides functions to help simulate VR controllers.
public override void ProcessUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void ProcessFixedUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override ControllerType GetCurrentControllerType(VRTK_ControllerReference controllerReference = null)
VRTK_ControllerReference controllerReference
- The reference to the controller to get type of.ControllerType
- The ControllerType based on the SDK and headset being used.The GetCurrentControllerType method returns the current used ControllerType based on the SDK and headset being used.
public override string GetControllerDefaultColliderPath(ControllerHand hand)
ControllerHand hand
- The controller hand to check forstring
- A path to the resource that contains the collider GameObject.The GetControllerDefaultColliderPath returns the path to the prefab that contains the collider objects for the default controller of this SDK.
public override string GetControllerElementPath(ControllerElements element, ControllerHand hand, bool fullPath = false)
ControllerElements element
- The controller element to look up.ControllerHand hand
- The controller hand to look up.bool fullPath
- Whether to get the initial path or the full path to the element.string
- A string containing the path to the game object that the controller element resides in.The GetControllerElementPath returns the path to the game object that the given controller element for the given hand resides in.
public override uint GetControllerIndex(GameObject controller)
GameObject controller
- The GameObject containing the controller.uint
- The index of the given controller.The GetControllerIndex method returns the index of the given controller.
public override GameObject GetControllerByIndex(uint index, bool actual = false)
uint index
- The index of the controller to find.bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject of the controllerThe GetControllerByIndex method returns the GameObject of a controller with a specific index.
public override Transform GetControllerOrigin(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to retrieve the origin from.Transform
- A Transform containing the origin of the controller.The GetControllerOrigin method returns the origin of the given controller.
public override GameObject GetControllerLeftHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the left hand controller.The GetControllerLeftHand method returns the GameObject containing the representation of the left hand controller.
public override GameObject GetControllerRightHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the right hand controller.The GetControllerRightHand method returns the GameObject containing the representation of the right hand controller.
public override bool IsControllerLeftHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/1 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/1 method is used to check if the given controller is the the right hand controller.
public override bool IsControllerLeftHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/2 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/2 method is used to check if the given controller is the the right hand controller.
public override bool WaitForControllerModel(ControllerHand hand)
ControllerHand hand
- The hand to determine if the controller model will be ready for.bool
- Returns true if the controller model requires loading in at runtime and therefore needs waiting for. Returns false if the controller model will be available at start.The WaitForControllerModel method determines whether the controller model for the given hand requires waiting to load in on scene start.
public override GameObject GetControllerModel(GameObject controller)
GameObject controller
- The GameObject to get the model alias for.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given GameObject.
public override GameObject GetControllerModel(ControllerHand hand)
ControllerHand hand
- The hand enum of which controller model to retrieve.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given controller hand.
public override GameObject GetControllerRenderModel(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to check.GameObject
- A GameObject containing the object that has a render model for the controller.The GetControllerRenderModel method gets the game object that contains the given controller's render model.
public override void SetControllerRenderModelWheel(GameObject renderModel, bool state)
GameObject renderModel
- The GameObject containing the controller render model.bool state
- If true and the render model has a scroll wheen then it will be displayed, if false then the scroll wheel will be hidden.The SetControllerRenderModelWheel method sets the state of the scroll wheel on the controller render model.
public override void HapticPulse(VRTK_ControllerReference controllerReference, float strength = 0.5f)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.float strength
- The intensity of the rumble of the controller motor. 0
to 1
.The HapticPulse/2 method is used to initiate a simple haptic pulse on the tracked object of the given controller reference.
public override bool HapticPulse(VRTK_ControllerReference controllerReference, AudioClip clip)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.AudioClip clip
- The audio clip to use for the haptic pattern.The HapticPulse/2 method is used to initiate a haptic pulse based on an audio clip on the tracked object of the given controller reference.
public override SDK_ControllerHapticModifiers GetHapticModifiers()
SDK_ControllerHapticModifiers
- An SDK_ControllerHapticModifiers object with a given durationModifier
and an intervalModifier
.The GetHapticModifiers method is used to return modifiers for the duration and interval if the SDK handles it slightly differently.
public override Vector3 GetVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current velocity of the tracked object.The GetVelocity method is used to determine the current velocity of the tracked object on the given controller reference.
public override Vector3 GetAngularVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current angular velocity of the tracked object.The GetAngularVelocity method is used to determine the current angular velocity of the tracked object on the given controller reference.
public override bool IsTouchpadStatic(bool isTouched, Vector2 currentAxisValues, Vector2 previousAxisValues, int compareFidelity)
Vector2 currentAxisValues
-Vector2 previousAxisValues
-int compareFidelity
-bool
- Returns true if the touchpad is not currently being touched or moved.The IsTouchpadStatic method is used to determine if the touchpad is currently not being moved.
public override Vector2 GetButtonAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button axis on.Vector2
- A Vector2 of the X/Y values of the button axis. If no axis values exist for the given button, then a Vector2.Zero is returned.The GetButtonAxis method retrieves the current X/Y axis values for the given button type on the given controller reference.
public override float GetButtonSenseAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the sense axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the sense axis on.float
- The current sense axis value.The GetButtonSenseAxis method retrieves the current sense axis value for the given button type on the given controller reference.
public override float GetButtonHairlineDelta(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to get the hairline delta for.VRTK_ControllerReference controllerReference
- The reference to the controller to get the hairline delta for.float
- The delta between the button presses.The GetButtonHairlineDelta method is used to get the difference between the current button press and the previous frame button press.
public override bool GetControllerButtonState(ButtonTypes buttonType, ButtonPressTypes pressType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the state of.ButtonPressTypes pressType
- The button state to check for.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button state on.bool
- Returns true if the given button is in the state of the given press type on the given controller reference.The GetControllerButtonState method is used to determine if the given controller button for the given press type on the given controller reference is currently taking place.
extends SDK_BaseBoundaries
The Sim Boundaries SDK script provides dummy functions for the play area boundaries.
public override void InitBoundaries()
The InitBoundaries method is run on start of scene and can be used to initialse anything on game start.
public override Transform GetPlayArea()
Transform
- A transform of the object representing the play area in the scene.The GetPlayArea method returns the Transform of the object that is used to represent the play area in the scene.
public override Vector3[] GetPlayAreaVertices()
Vector3[]
- A Vector3 array of the points in the scene that represent the play area boundaries.The GetPlayAreaVertices method returns the points of the play area boundaries.
public override float GetPlayAreaBorderThickness()
float
- The thickness of the drawn border.The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
public override bool IsPlayAreaSizeCalibrated()
bool
- Returns true if the play area size has been auto calibrated and set by external sensors.The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
public override bool GetDrawAtRuntime()
bool
- Returns true if the drawn border is being displayed.The GetDrawAtRuntime method returns whether the given play area drawn border is being displayed.
public override void SetDrawAtRuntime(bool value)
bool value
- The state of whether the drawn border should be displayed or not.The SetDrawAtRuntime method sets whether the given play area drawn border should be displayed at runtime.
The scripts used to utilise the SteamVR Unity Plugin SDK.
Handles all the scripting define symbols for the SteamVR SDK.
public const string ScriptingDefineSymbol
- The scripting define symbol for the SteamVR SDK. Default: SDK_ScriptingDefineSymbolPredicateAttribute.RemovableSymbolPrefix + "SDK_STEAMVR"
The SteamVR System SDK script provides a bridge to the SteamVR SDK.
public override bool IsDisplayOnDesktop()
bool
- Returns true if the display is extending the desktopThe IsDisplayOnDesktop method returns true if the display is extending the desktop.
public override bool ShouldAppRenderWithLowResources()
bool
- Returns true if the Unity app should render with low resources.The ShouldAppRenderWithLowResources method is used to determine if the Unity app should use low resource mode. Typically true when the dashboard is showing.
public override void ForceInterleavedReprojectionOn(bool force)
bool force
- If true then Interleaved Reprojection will be forced on, if false it will not be forced on.The ForceInterleavedReprojectionOn method determines whether Interleaved Reprojection should be forced on or off.
The SteamVR Headset SDK script provides a bridge to the SteamVR SDK.
public override void ProcessUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void ProcessFixedUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override Transform GetHeadset()
Transform
- A transform of the object representing the headset in the scene.The GetHeadset method returns the Transform of the object that is used to represent the headset in the scene.
public override Transform GetHeadsetCamera()
Transform
- A transform of the object holding the headset camera in the scene.The GetHeadsetCamera method returns the Transform of the object that is used to hold the headset camera in the scene.
public override string GetHeadsetType()
string
- The string of the headset connected.The GetHeadsetType method returns a string representing the type of headset connected.
public override Vector3 GetHeadsetVelocity()
Vector3
- A Vector3 containing the current velocity of the headset.The GetHeadsetVelocity method is used to determine the current velocity of the headset.
public override Vector3 GetHeadsetAngularVelocity()
Vector3
- A Vector3 containing the current angular velocity of the headset.The GetHeadsetAngularVelocity method is used to determine the current angular velocity of the headset.
public override void HeadsetFade(Color color, float duration, bool fadeOverlay = false)
Color color
- The colour to fade to.float duration
- The amount of time the fade should take to reach the given colour.bool fadeOverlay
- Determines whether to use an overlay on the fade.The HeadsetFade method is used to apply a fade to the headset camera to progressively change the colour.
public override bool HasHeadsetFade(Transform obj)
Transform obj
- The Transform to check to see if a camera fade is available on.bool
- Returns true if the headset has fade functionality on it.The HasHeadsetFade method checks to see if the given game object (usually the camera) has the ability to fade the viewpoint.
public override void AddHeadsetFade(Transform camera)
Transform camera
- The Transform to with the camera on to add the fade functionality to.The AddHeadsetFade method attempts to add the fade functionality to the game object with the camera on it.
The SteamVR Controller SDK script provides a bridge to SDK methods that deal with the input devices.
public override void OnAfterSetupUnload(VRTK_SDKSetup setup)
VRTK_SDKSetup setup
- The SDK Setup which is using this SDK.This method is called just after unloading the VRTK_SDKSetup that's using this SDK.
public override void ProcessUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void ProcessFixedUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override ControllerType GetCurrentControllerType(VRTK_ControllerReference controllerReference = null)
VRTK_ControllerReference controllerReference
- The reference to the controller to get type of.ControllerType
- The ControllerType based on the SDK and headset being used.The GetCurrentControllerType method returns the current used ControllerType based on the SDK and headset being used.
public override string GetControllerDefaultColliderPath(ControllerHand hand)
ControllerHand hand
- The controller hand to check forstring
- A path to the resource that contains the collider GameObject.The GetControllerDefaultColliderPath returns the path to the prefab that contains the collider objects for the default controller of this SDK.
public override string GetControllerElementPath(ControllerElements element, ControllerHand hand, bool fullPath = false)
ControllerElements element
- The controller element to look up.ControllerHand hand
- The controller hand to look up.bool fullPath
- Whether to get the initial path or the full path to the element.string
- A string containing the path to the game object that the controller element resides in.The GetControllerElementPath returns the path to the game object that the given controller element for the given hand resides in.
public override uint GetControllerIndex(GameObject controller)
GameObject controller
- The GameObject containing the controller.uint
- The index of the given controller.The GetControllerIndex method returns the index of the given controller.
public override GameObject GetControllerByIndex(uint index, bool actual = false)
uint index
- The index of the controller to find.bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject of the controllerThe GetControllerByIndex method returns the GameObject of a controller with a specific index.
public override Transform GetControllerOrigin(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to retrieve the origin from.Transform
- A Transform containing the origin of the controller.The GetControllerOrigin method returns the origin of the given controller.
public override GameObject GetControllerLeftHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the left hand controller.The GetControllerLeftHand method returns the GameObject containing the representation of the left hand controller.
public override GameObject GetControllerRightHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the right hand controller.The GetControllerRightHand method returns the GameObject containing the representation of the right hand controller.
public override bool IsControllerLeftHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/1 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/1 method is used to check if the given controller is the the right hand controller.
public override bool IsControllerLeftHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/2 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/2 method is used to check if the given controller is the the right hand controller.
public override bool WaitForControllerModel(ControllerHand hand)
ControllerHand hand
- The hand to determine if the controller model will be ready for.bool
- Returns true if the controller model requires loading in at runtime and therefore needs waiting for. Returns false if the controller model will be available at start.The WaitForControllerModel method determines whether the controller model for the given hand requires waiting to load in on scene start.
public override GameObject GetControllerModel(GameObject controller)
GameObject controller
- The GameObject to get the model alias for.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given GameObject.
public override GameObject GetControllerModel(ControllerHand hand)
ControllerHand hand
- The hand enum of which controller model to retrieve.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given controller hand.
public override GameObject GetControllerRenderModel(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to check.GameObject
- A GameObject containing the object that has a render model for the controller.The GetControllerRenderModel method gets the game object that contains the given controller's render model.
public override void SetControllerRenderModelWheel(GameObject renderModel, bool state)
GameObject renderModel
- The GameObject containing the controller render model.bool state
- If true and the render model has a scroll wheen then it will be displayed, if false then the scroll wheel will be hidden.The SetControllerRenderModelWheel method sets the state of the scroll wheel on the controller render model.
public override void HapticPulse(VRTK_ControllerReference controllerReference, float strength = 0.5f)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.float strength
- The intensity of the rumble of the controller motor. 0
to 1
.The HapticPulse/2 method is used to initiate a simple haptic pulse on the tracked object of the given controller reference.
public override bool HapticPulse(VRTK_ControllerReference controllerReference, AudioClip clip)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.AudioClip clip
- The audio clip to use for the haptic pattern.The HapticPulse/2 method is used to initiate a haptic pulse based on an audio clip on the tracked object of the given controller reference.
public override SDK_ControllerHapticModifiers GetHapticModifiers()
SDK_ControllerHapticModifiers
- An SDK_ControllerHapticModifiers object with a given durationModifier
and an intervalModifier
.The GetHapticModifiers method is used to return modifiers for the duration and interval if the SDK handles it slightly differently.
public override Vector3 GetVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current velocity of the tracked object.The GetVelocity method is used to determine the current velocity of the tracked object on the given controller reference.
public override Vector3 GetAngularVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current angular velocity of the tracked object.The GetAngularVelocity method is used to determine the current angular velocity of the tracked object on the given controller reference.
public override bool IsTouchpadStatic(bool isTouched, Vector2 currentAxisValues, Vector2 previousAxisValues, int compareFidelity)
Vector2 currentAxisValues
-Vector2 previousAxisValues
-int compareFidelity
-bool
- Returns true if the touchpad is not currently being touched or moved.The IsTouchpadStatic method is used to determine if the touchpad is currently not being moved.
public override Vector2 GetButtonAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button axis on.Vector2
- A Vector2 of the X/Y values of the button axis. If no axis values exist for the given button, then a Vector2.Zero is returned.The GetButtonAxis method retrieves the current X/Y axis values for the given button type on the given controller reference.
public override float GetButtonSenseAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the sense axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the sense axis on.float
- The current sense axis value.The GetButtonSenseAxis method retrieves the current sense axis value for the given button type on the given controller reference.
public override float GetButtonHairlineDelta(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to get the hairline delta for.VRTK_ControllerReference controllerReference
- The reference to the controller to get the hairline delta for.float
- The delta between the button presses.The GetButtonHairlineDelta method is used to get the difference between the current button press and the previous frame button press.
public override bool GetControllerButtonState(ButtonTypes buttonType, ButtonPressTypes pressType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the state of.ButtonPressTypes pressType
- The button state to check for.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button state on.bool
- Returns true if the given button is in the state of the given press type on the given controller reference.The GetControllerButtonState method is used to determine if the given controller button for the given press type on the given controller reference is currently taking place.
The SteamVR Boundaries SDK script provides a bridge to the SteamVR SDK play area.
public override void InitBoundaries()
The InitBoundaries method is run on start of scene and can be used to initialse anything on game start.
public override Transform GetPlayArea()
Transform
- A transform of the object representing the play area in the scene.The GetPlayArea method returns the Transform of the object that is used to represent the play area in the scene.
public override Vector3[] GetPlayAreaVertices()
Vector3[]
- A Vector3 array of the points in the scene that represent the play area boundaries.The GetPlayAreaVertices method returns the points of the play area boundaries.
public override float GetPlayAreaBorderThickness()
float
- The thickness of the drawn border.The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
public override bool IsPlayAreaSizeCalibrated()
bool
- Returns true if the play area size has been auto calibrated and set by external sensors.The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
public override bool GetDrawAtRuntime()
bool
- Returns true if the drawn border is being displayed.The GetDrawAtRuntime method returns whether the given play area drawn border is being displayed.
public override void SetDrawAtRuntime(bool value)
bool value
- The state of whether the drawn border should be displayed or not.The SetDrawAtRuntime method sets whether the given play area drawn border should be displayed at runtime.
The scripts used to utilise the Oculus Integration Unity Package SDK.
Handles all the scripting define symbols for the Oculus and Avatar SDKs.
public const string ScriptingDefineSymbol
- The scripting define symbol for the Oculus SDK. Default: SDK_ScriptingDefineSymbolPredicateAttribute.RemovableSymbolPrefix + "SDK_OCULUS"
public const string AvatarScriptingDefineSymbol
- The scripting define symbol for the Oculus Avatar SDK. Default: SDK_ScriptingDefineSymbolPredicateAttribute.RemovableSymbolPrefix + "SDK_OCULUS_AVATAR"
The Oculus System SDK script provides a bridge to the Oculus SDK.
public override bool IsDisplayOnDesktop()
bool
- Returns true if the display is extending the desktopThe IsDisplayOnDesktop method returns true if the display is extending the desktop.
public override bool ShouldAppRenderWithLowResources()
bool
- Returns true if the Unity app should render with low resources.The ShouldAppRenderWithLowResources method is used to determine if the Unity app should use low resource mode. Typically true when the dashboard is showing.
public override void ForceInterleavedReprojectionOn(bool force)
bool force
- If true then Interleaved Reprojection will be forced on, if false it will not be forced on.The ForceInterleavedReprojectionOn method determines whether Interleaved Reprojection should be forced on or off.
The Oculus Headset SDK script provides a bridge to the Oculus SDK.
public override void ProcessUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void ProcessFixedUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override Transform GetHeadset()
Transform
- A transform of the object representing the headset in the scene.The GetHeadset method returns the Transform of the object that is used to represent the headset in the scene.
public override Transform GetHeadsetCamera()
Transform
- A transform of the object holding the headset camera in the scene.The GetHeadsetCamera method returns the Transform of the object that is used to hold the headset camera in the scene.
public override string GetHeadsetType()
string
- The string of the headset connected.The GetHeadsetType method returns a string representing the type of headset connected.
public override Vector3 GetHeadsetVelocity()
Vector3
- A Vector3 containing the current velocity of the headset.The GetHeadsetVelocity method is used to determine the current velocity of the headset.
public override Vector3 GetHeadsetAngularVelocity()
Vector3
- A Vector3 containing the current angular velocity of the headset.The GetHeadsetAngularVelocity method is used to determine the current angular velocity of the headset.
public override void HeadsetFade(Color color, float duration, bool fadeOverlay = false)
Color color
- The colour to fade to.float duration
- The amount of time the fade should take to reach the given colour.bool fadeOverlay
- Determines whether to use an overlay on the fade.The HeadsetFade method is used to apply a fade to the headset camera to progressively change the colour.
public override bool HasHeadsetFade(Transform obj)
Transform obj
- The Transform to check to see if a camera fade is available on.bool
- Returns true if the headset has fade functionality on it.The HasHeadsetFade method checks to see if the given game object (usually the camera) has the ability to fade the viewpoint.
public override void AddHeadsetFade(Transform camera)
Transform camera
- The Transform to with the camera on to add the fade functionality to.The AddHeadsetFade method attempts to add the fade functionality to the game object with the camera on it.
The Oculus Controller SDK script provides a bridge to SDK methods that deal with the input devices.
public override void OnAfterSetupLoad(VRTK_SDKSetup setup)
VRTK_SDKSetup setup
- The SDK Setup which is using this SDK.This method is called just after loading the VRTK_SDKSetup that's using this SDK.
public override void ProcessUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void ProcessFixedUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override ControllerType GetCurrentControllerType(VRTK_ControllerReference controllerReference = null)
VRTK_ControllerReference controllerReference
- The reference to the controller to get type of.ControllerType
- The ControllerType based on the SDK and headset being used.The GetCurrentControllerType method returns the current used ControllerType based on the SDK and headset being used.
public override string GetControllerDefaultColliderPath(ControllerHand hand)
ControllerHand hand
- The controller hand to check forstring
- A path to the resource that contains the collider GameObject.The GetControllerDefaultColliderPath returns the path to the prefab that contains the collider objects for the default controller of this SDK.
public override string GetControllerElementPath(ControllerElements element, ControllerHand hand, bool fullPath = false)
ControllerElements element
- The controller element to look up.ControllerHand hand
- The controller hand to look up.bool fullPath
- Whether to get the initial path or the full path to the element.string
- A string containing the path to the game object that the controller element resides in.The GetControllerElementPath returns the path to the game object that the given controller element for the given hand resides in.
public override uint GetControllerIndex(GameObject controller)
GameObject controller
- The GameObject containing the controller.uint
- The index of the given controller.The GetControllerIndex method returns the index of the given controller.
public override GameObject GetControllerByIndex(uint index, bool actual = false)
uint index
- The index of the controller to find.bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject of the controllerThe GetControllerByIndex method returns the GameObject of a controller with a specific index.
public override Transform GetControllerOrigin(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to retrieve the origin from.Transform
- A Transform containing the origin of the controller.The GetControllerOrigin method returns the origin of the given controller.
public override GameObject GetControllerLeftHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the left hand controller.The GetControllerLeftHand method returns the GameObject containing the representation of the left hand controller.
public override GameObject GetControllerRightHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the right hand controller.The GetControllerRightHand method returns the GameObject containing the representation of the right hand controller.
public override bool IsControllerLeftHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/1 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/1 method is used to check if the given controller is the the right hand controller.
public override bool IsControllerLeftHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/2 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/2 method is used to check if the given controller is the the right hand controller.
public override bool WaitForControllerModel(ControllerHand hand)
ControllerHand hand
- The hand to determine if the controller model will be ready for.bool
- Returns true if the controller model requires loading in at runtime and therefore needs waiting for. Returns false if the controller model will be available at start.The WaitForControllerModel method determines whether the controller model for the given hand requires waiting to load in on scene start.
public override GameObject GetControllerModel(GameObject controller)
GameObject controller
- The GameObject to get the model alias for.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given GameObject.
public override GameObject GetControllerModel(ControllerHand hand)
ControllerHand hand
- The hand enum of which controller model to retrieve.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given controller hand.
public override GameObject GetControllerRenderModel(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to check.GameObject
- A GameObject containing the object that has a render model for the controller.The GetControllerRenderModel method gets the game object that contains the given controller's render model.
public override void SetControllerRenderModelWheel(GameObject renderModel, bool state)
GameObject renderModel
- The GameObject containing the controller render model.bool state
- If true and the render model has a scroll wheen then it will be displayed, if false then the scroll wheel will be hidden.The SetControllerRenderModelWheel method sets the state of the scroll wheel on the controller render model.
public override void HapticPulse(VRTK_ControllerReference controllerReference, float strength = 0.5f)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.float strength
- The intensity of the rumble of the controller motor. 0
to 1
.The HapticPulse/2 method is used to initiate a simple haptic pulse on the tracked object of the given controller reference.
public override bool HapticPulse(VRTK_ControllerReference controllerReference, AudioClip clip)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.AudioClip clip
- The audio clip to use for the haptic pattern.The HapticPulse/2 method is used to initiate a haptic pulse based on an audio clip on the tracked object of the given controller reference.
public override SDK_ControllerHapticModifiers GetHapticModifiers()
SDK_ControllerHapticModifiers
- An SDK_ControllerHapticModifiers object with a given durationModifier
and an intervalModifier
.The GetHapticModifiers method is used to return modifiers for the duration and interval if the SDK handles it slightly differently.
public override Vector3 GetVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current velocity of the tracked object.The GetVelocity method is used to determine the current velocity of the tracked object on the given controller reference.
public override Vector3 GetAngularVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current angular velocity of the tracked object.The GetAngularVelocity method is used to determine the current angular velocity of the tracked object on the given controller reference.
public override bool IsTouchpadStatic(bool isTouched, Vector2 currentAxisValues, Vector2 previousAxisValues, int compareFidelity)
Vector2 currentAxisValues
-Vector2 previousAxisValues
-int compareFidelity
-bool
- Returns true if the touchpad is not currently being touched or moved.The IsTouchpadStatic method is used to determine if the touchpad is currently not being moved.
public override Vector2 GetButtonAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button axis on.Vector2
- A Vector2 of the X/Y values of the button axis. If no axis values exist for the given button, then a Vector2.Zero is returned.The GetButtonAxis method retrieves the current X/Y axis values for the given button type on the given controller reference.
public override float GetButtonSenseAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the sense axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the sense axis on.float
- The current sense axis value.The GetButtonSenseAxis method retrieves the current sense axis value for the given button type on the given controller reference.
public override float GetButtonHairlineDelta(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to get the hairline delta for.VRTK_ControllerReference controllerReference
- The reference to the controller to get the hairline delta for.float
- The delta between the button presses.The GetButtonHairlineDelta method is used to get the difference between the current button press and the previous frame button press.
public override bool GetControllerButtonState(ButtonTypes buttonType, ButtonPressTypes pressType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the state of.ButtonPressTypes pressType
- The button state to check for.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button state on.bool
- Returns true if the given button is in the state of the given press type on the given controller reference.The GetControllerButtonState method is used to determine if the given controller button for the given press type on the given controller reference is currently taking place.
The Oculus Boundaries SDK script provides a bridge to the Oculus SDK play area.
public override void InitBoundaries()
The InitBoundaries method is run on start of scene and can be used to initialse anything on game start.
public override Transform GetPlayArea()
Transform
- A transform of the object representing the play area in the scene.The GetPlayArea method returns the Transform of the object that is used to represent the play area in the scene.
public override Vector3[] GetPlayAreaVertices()
Vector3[]
- A Vector3 array of the points in the scene that represent the play area boundaries.The GetPlayAreaVertices method returns the points of the play area boundaries.
public override float GetPlayAreaBorderThickness()
float
- The thickness of the drawn border.The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
public override bool IsPlayAreaSizeCalibrated()
bool
- Returns true if the play area size has been auto calibrated and set by external sensors.The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
public override bool GetDrawAtRuntime()
bool
- Returns true if the drawn border is being displayed.The GetDrawAtRuntime method returns whether the given play area drawn border is being displayed.
public override void SetDrawAtRuntime(bool value)
bool value
- The state of whether the drawn border should be displayed or not.The SetDrawAtRuntime method sets whether the given play area drawn border should be displayed at runtime.
public virtual OvrAvatar GetAvatar()
OvrAvatar
- The OvrAvatar script for managing the Oculus Avatar.The GetAvatar method is used to retrieve the Oculus Avatar object if it exists in the scene. This method is only available if the Oculus Avatar package is installed.
The scripts used to utilise Windows Mixed Reality Unity SDK.
Handles all the scripting define symbols for the Windows Immersive Mixed Reality SDK.
public const string ScriptingDefineSymbol
- The scripting define symbol for the Immersive Mixed Reality SDK. Default: SDK_ScriptingDefineSymbolPredicateAttribute.RemovableSymbolPrefix + "SDK_WINDOWSMR"
The Windows Mixed Reality System SDK script provides a bridge to the Windows Mixed Reality Unity SDK.
public override void ForceInterleavedReprojectionOn(bool force)
bool force
- If true then Interleaved Reprojection will be forced on, if false it will not be forced on.The ForceInterleavedReprojectionOn method determines whether Interleaved Reprojection should be forced on or off.
public override bool IsDisplayOnDesktop()
bool
- Returns true if the display is extending the desktopThe IsDisplayOnDesktop method returns true if the display is extending the desktop.
public override bool ShouldAppRenderWithLowResources()
bool
- Returns true if the Unity app should render with low resources.The ShouldAppRenderWithLowResources method is used to determine if the Unity app should use low resource mode. Typically true when the dashboard is showing.
The WindowsMR Headset SDK script provides a bridge to the WindowsMR XR.
public override void ProcessFixedUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override void ProcessUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override Transform GetHeadset()
Transform
- A transform of the object representing the headset in the scene.The GetHeadset method returns the Transform of the object that is used to represent the headset in the scene.
public override Vector3 GetHeadsetAngularVelocity()
Vector3
- A Vector3 containing the current angular velocity of the headset.The GetHeadsetAngularVelocity method is used to determine the current angular velocity of the headset.
public override Transform GetHeadsetCamera()
Transform
- A transform of the object holding the headset camera in the scene.The GetHeadsetCamera method returns the Transform of the object that is used to hold the headset camera in the scene.
public override Vector3 GetHeadsetVelocity()
Vector3
- A Vector3 containing the current velocity of the headset.The GetHeadsetVelocity method is used to determine the current velocity of the headset.
public override bool HasHeadsetFade(Transform obj)
Transform obj
- The Transform to check to see if a camera fade is available on.bool
- Returns true if the headset has fade functionality on it.The HasHeadsetFade method checks to see if the given game object (usually the camera) has the ability to fade the viewpoint.
public override void HeadsetFade(Color color, float duration, bool fadeOverlay = false)
Color color
- The colour to fade to.float duration
- The amount of time the fade should take to reach the given colour.bool fadeOverlay
- Determines whether to use an overlay on the fade.The HeadsetFade method is used to apply a fade to the headset camera to progressively change the colour.
public override void AddHeadsetFade(Transform camera)
Transform camera
- The Transform to with the camera on to add the fade functionality to.The AddHeadsetFade method attempts to add the fade functionality to the game object with the camera on it.
public override string GetHeadsetType()
string
- The string of the headset connected.The GetHeadsetType method returns a string representing the type of headset connected.
The WindowsMR Controller SDK script provides a bridge to SDK methods that deal with the input devices.
public override Vector3 GetAngularVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current angular velocity of the tracked object.The GetAngularVelocity method is used to determine the current angular velocity of the tracked object on the given controller reference.
public override Vector2 GetButtonAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button axis on.Vector2
- A Vector2 of the X/Y values of the button axis. If no axis values exist for the given button, then a Vector2.Zero is returned.The GetButtonAxis method retrieves the current X/Y axis values for the given button type on the given controller reference.
public override float GetButtonSenseAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the sense axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the sense axis on.float
- The current sense axis value.The GetButtonSenseAxis method retrieves the current sense axis value for the given button type on the given controller reference.
public override float GetButtonHairlineDelta(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to get the hairline delta for.VRTK_ControllerReference controllerReference
- The reference to the controller to get the hairline delta for.float
- The delta between the button presses.The GetButtonHairlineDelta method is used to get the difference between the current button press and the previous frame button press.
public override bool GetControllerButtonState(ButtonTypes buttonType, ButtonPressTypes pressType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the state of.ButtonPressTypes pressType
- The button state to check for.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button state on.bool
- Returns true if the given button is in the state of the given press type on the given controller reference.The GetControllerButtonState method is used to determine if the given controller button for the given press type on the given controller reference is currently taking place.
public override GameObject GetControllerByIndex(uint index, bool actual = false)
uint index
- The index of the controller to find.bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject of the controllerThe GetControllerByIndex method returns the GameObject of a controller with a specific index.
public override string GetControllerDefaultColliderPath(ControllerHand hand)
ControllerHand hand
- The controller hand to check forstring
- A path to the resource that contains the collider GameObject.The GetControllerDefaultColliderPath returns the path to the prefab that contains the collider objects for the default controller of this SDK.
public override string GetControllerElementPath(ControllerElements element, ControllerHand hand, bool fullPath = false)
ControllerElements element
- The controller element to look up.ControllerHand hand
- The controller hand to look up.bool fullPath
- Whether to get the initial path or the full path to the element.string
- A string containing the path to the game object that the controller element resides in.The GetControllerElementPath returns the path to the game object that the given controller element for the given hand resides in.
public override uint GetControllerIndex(GameObject controller)
GameObject controller
- The GameObject containing the controller.uint
- The index of the given controller.The GetControllerIndex method returns the index of the given controller.
public override GameObject GetControllerLeftHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the left hand controller.The GetControllerLeftHand method returns the GameObject containing the representation of the left hand controller.
public override GameObject GetControllerModel(GameObject controller)
GameObject controller
- The GameObject to get the model alias for.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given GameObject.
public override GameObject GetControllerModel(ControllerHand hand)
ControllerHand hand
- The hand enum of which controller model to retrieve.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given controller hand.
public override Transform GetControllerOrigin(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to retrieve the origin from.Transform
- A Transform containing the origin of the controller.The GetControllerOrigin method returns the origin of the given controller.
public override GameObject GetControllerRenderModel(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to check.GameObject
- A GameObject containing the object that has a render model for the controller.The GetControllerRenderModel method gets the game object that contains the given controller's render model.
public override GameObject GetControllerRightHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the right hand controller.The GetControllerRightHand method returns the GameObject containing the representation of the right hand controller.
public override ControllerType GetCurrentControllerType(VRTK_ControllerReference controllerReference = null)
ControllerType
- The ControllerType based on the SDK and headset being used.The GetCurrentControllerType method returns the current used ControllerType based on the SDK and headset being used.
public override SDK_ControllerHapticModifiers GetHapticModifiers()
SDK_ControllerHapticModifiers
- An SDK_ControllerHapticModifiers object with a given durationModifier
and an intervalModifier
.The GetHapticModifiers method is used to return modifiers for the duration and interval if the SDK handles it slightly differently.
public override Vector3 GetVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current velocity of the tracked object.The GetVelocity method is used to determine the current velocity of the tracked object on the given controller reference.
public override void HapticPulse(VRTK_ControllerReference controllerReference, float strength = 0.5F)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.float strength
- The intensity of the rumble of the controller motor. 0
to 1
.The HapticPulse/2 method is used to initiate a simple haptic pulse on the tracked object of the given controller reference.
public override bool HapticPulse(VRTK_ControllerReference controllerReference, AudioClip clip)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.AudioClip clip
- The audio clip to use for the haptic pattern.The HapticPulse/2 method is used to initiate a haptic pulse based on an audio clip on the tracked object of the given controller reference.
public override bool IsControllerLeftHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/1 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerLeftHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/2 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/1 method is used to check if the given controller is the the right hand controller.
public override bool IsControllerRightHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/2 method is used to check if the given controller is the the right hand controller.
public override bool IsTouchpadStatic(bool isTouched, Vector2 currentAxisValues, Vector2 previousAxisValues, int compareFidelity)
Vector2 currentAxisValues
-Vector2 previousAxisValues
-int compareFidelity
-bool
- Returns true if the touchpad is not currently being touched or moved.The IsTouchpadStatic method is used to determine if the touchpad is currently not being moved.
public override void ProcessFixedUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override void ProcessUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void SetControllerRenderModelWheel(GameObject renderModel, bool state)
GameObject renderModel
- The GameObject containing the controller render model.bool state
- If true and the render model has a scroll wheen then it will be displayed, if false then the scroll wheel will be hidden.The SetControllerRenderModelWheel method sets the state of the scroll wheel on the controller render model.
public override bool WaitForControllerModel(ControllerHand hand)
ControllerHand hand
- The hand to determine if the controller model will be ready for.bool
- Returns true if the controller model requires loading in at runtime and therefore needs waiting for. Returns false if the controller model will be available at start.The WaitForControllerModel method determines whether the controller model for the given hand requires waiting to load in on scene start.
The WindowsMR Boundaries SDK script provides a bridge to the Windows Mixed Reality SDK play area.
public override bool GetDrawAtRuntime()
bool
- Returns true if the drawn border is being displayed.The GetDrawAtRuntime method returns whether the given play area drawn border is being displayed.
public override Transform GetPlayArea()
Transform
- A transform of the object representing the play area in the scene.The GetPlayArea method returns the Transform of the object that is used to represent the play area in the scene.
public override float GetPlayAreaBorderThickness()
float
- The thickness of the drawn border.The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
public override Vector3[] GetPlayAreaVertices()
Vector3[]
- A Vector3 array of the points in the scene that represent the play area boundaries.The GetPlayAreaVertices method returns the points of the play area boundaries.
public override void InitBoundaries()
The InitBoundaries method is run on start of scene and can be used to initialse anything on game start.
public override bool IsPlayAreaSizeCalibrated()
bool
- Returns true if the play area size has been auto calibrated and set by external sensors.The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
public override void SetDrawAtRuntime(bool value)
bool value
- The state of whether the drawn border should be displayed or not.The SetDrawAtRuntime method sets whether the given play area drawn border should be displayed at runtime.
The scripts used to utilise the Google VR SDK for Unity.
Handles all the scripting define symbols for the Daydream SDK.
public const string ScriptingDefineSymbol
- The scripting define symbol for the Daydream SDK. Default: SDK_ScriptingDefineSymbolPredicateAttribute.RemovableSymbolPrefix + "SDK_DAYDREAM"
The Daydream System SDK script provides dummy functions for system functions.
public override bool IsDisplayOnDesktop()
bool
- Returns true if the display is extending the desktopThe IsDisplayOnDesktop method returns true if the display is extending the desktop.
public override bool ShouldAppRenderWithLowResources()
bool
- Returns true if the Unity app should render with low resources.The ShouldAppRenderWithLowResources method is used to determine if the Unity app should use low resource mode. Typically true when the dashboard is showing.
public override void ForceInterleavedReprojectionOn(bool force)
bool force
- If true then Interleaved Reprojection will be forced on, if false it will not be forced on.The ForceInterleavedReprojectionOn method determines whether Interleaved Reprojection should be forced on or off.
The Daydream Headset SDK script provides dummy functions for the headset.
public override void ProcessUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void ProcessFixedUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override Transform GetHeadset()
Transform
- A transform of the object representing the headset in the scene.The GetHeadset method returns the Transform of the object that is used to represent the headset in the scene.
public override Transform GetHeadsetCamera()
Transform
- A transform of the object holding the headset camera in the scene.The GetHeadsetCamera/0 method returns the Transform of the object that is used to hold the headset camera in the scene.
public override string GetHeadsetType()
string
- The string of the headset connected.The GetHeadsetType method returns a string representing the type of headset connected.
public override Vector3 GetHeadsetVelocity()
Vector3
- A Vector3 containing the current velocity of the headset.The GetHeadsetVelocity method is used to determine the current velocity of the headset.
public override Vector3 GetHeadsetAngularVelocity()
Vector3
- A Vector3 containing the current angular velocity of the headset.The GetHeadsetAngularVelocity method is used to determine the current angular velocity of the headset.
public override void HeadsetFade(Color color, float duration, bool fadeOverlay = false)
Color color
- The colour to fade to.float duration
- The amount of time the fade should take to reach the given colour.bool fadeOverlay
- Determines whether to use an overlay on the fade.The HeadsetFade method is used to apply a fade to the headset camera to progressively change the colour.
public override bool HasHeadsetFade(Transform obj)
Transform obj
- The Transform to check to see if a camera fade is available on.bool
- Returns true if the headset has fade functionality on it.The HasHeadsetFade method checks to see if the given game object (usually the camera) has the ability to fade the viewpoint.
public override void AddHeadsetFade(Transform camera)
Transform camera
- The Transform to with the camera on to add the fade functionality to.The AddHeadsetFade method attempts to add the fade functionality to the game object with the camera on it.
The Daydream Controller SDK script provides a bridge to SDK methods that deal with the input devices.
public override void ProcessUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void ProcessFixedUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override ControllerType GetCurrentControllerType(VRTK_ControllerReference controllerReference = null)
VRTK_ControllerReference controllerReference
- The reference to the controller to get type of.ControllerType
- The ControllerType based on the SDK and headset being used.The GetCurrentControllerType method returns the current used ControllerType based on the SDK and headset being used.
public override string GetControllerDefaultColliderPath(ControllerHand hand)
ControllerHand hand
- The controller hand to check forstring
- A path to the resource that contains the collider GameObject.The GetControllerDefaultColliderPath returns the path to the prefab that contains the collider objects for the default controller of this SDK.
public override string GetControllerElementPath(ControllerElements element, ControllerHand hand, bool fullPath = false)
ControllerElements element
- The controller element to look up.ControllerHand hand
- The controller hand to look up.bool fullPath
- Whether to get the initial path or the full path to the element.string
- A string containing the path to the game object that the controller element resides in.The GetControllerElementPath returns the path to the game object that the given controller element for the given hand resides in.
public override uint GetControllerIndex(GameObject controller)
GameObject controller
- The GameObject containing the controller.uint
- The index of the given controller.The GetControllerIndex method returns the index of the given controller.
public override GameObject GetControllerByIndex(uint index, bool actual = false)
uint index
- The index of the controller to find.bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
-The GetControllerByIndex method returns the GameObject of a controller with a specific index.
public override Transform GetControllerOrigin(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to retrieve the origin from.Transform
- A Transform containing the origin of the controller.The GetControllerOrigin method returns the origin of the given controller.
public override GameObject GetControllerLeftHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the left hand controller.The GetControllerLeftHand method returns the GameObject containing the representation of the left hand controller.
public override GameObject GetControllerRightHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the right hand controller.The GetControllerRightHand method returns the GameObject containing the representation of the right hand controller.
public override bool IsControllerLeftHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/1 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/1 method is used to check if the given controller is the the right hand controller.
public override bool IsControllerLeftHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/2 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/2 method is used to check if the given controller is the the right hand controller.
public override bool WaitForControllerModel(ControllerHand hand)
ControllerHand hand
- The hand to determine if the controller model will be ready for.bool
- Returns true if the controller model requires loading in at runtime and therefore needs waiting for. Returns false if the controller model will be available at start.The WaitForControllerModel method determines whether the controller model for the given hand requires waiting to load in on scene start.
public override GameObject GetControllerModel(GameObject controller)
GameObject controller
- The GameObject to get the model alias for.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given GameObject.
public override GameObject GetControllerModel(ControllerHand hand)
ControllerHand hand
- The hand enum of which controller model to retrieve.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given controller hand.
public override GameObject GetControllerRenderModel(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to check.GameObject
- A GameObject containing the object that has a render model for the controller.The GetControllerRenderModel method gets the game object that contains the given controller's render model.
public override void SetControllerRenderModelWheel(GameObject renderModel, bool state)
GameObject renderModel
- The GameObject containing the controller render model.bool state
- If true and the render model has a scroll wheen then it will be displayed, if false then the scroll wheel will be hidden.The SetControllerRenderModelWheel method sets the state of the scroll wheel on the controller render model.
public override void HapticPulse(VRTK_ControllerReference controllerReference, float strength = 0.5f)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.float strength
- The intensity of the rumble of the controller motor. 0
to 1
.The HapticPulse/2 method is used to initiate a simple haptic pulse on the tracked object of the given controller reference.
public override bool HapticPulse(VRTK_ControllerReference controllerReference, AudioClip clip)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.AudioClip clip
- The audio clip to use for the haptic pattern.The HapticPulse/2 method is used to initiate a haptic pulse based on an audio clip on the tracked object of the given controller reference.
public override SDK_ControllerHapticModifiers GetHapticModifiers()
SDK_ControllerHapticModifiers
- An SDK_ControllerHapticModifiers object with a given durationModifier
and an intervalModifier
.The GetHapticModifiers method is used to return modifiers for the duration and interval if the SDK handles it slightly differently.
public override Vector3 GetVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current velocity of the tracked object.The GetVelocity method is used to determine the current velocity of the tracked object on the given controller reference.
public override Vector3 GetAngularVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current angular velocity of the tracked object.The GetAngularVelocity method is used to determine the current angular velocity of the tracked object on the given controller reference.
public override bool IsTouchpadStatic(bool isTouched, Vector2 currentAxisValues, Vector2 previousAxisValues, int compareFidelity)
Vector2 currentAxisValues
-Vector2 previousAxisValues
-int compareFidelity
-bool
- Returns true if the touchpad is not currently being touched or moved.The IsTouchpadStatic method is used to determine if the touchpad is currently not being moved.
public override Vector2 GetButtonAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button axis on.Vector2
- A Vector2 of the X/Y values of the button axis. If no axis values exist for the given button, then a Vector2.Zero is returned.The GetButtonAxis method retrieves the current X/Y axis values for the given button type on the given controller reference.
public override float GetButtonSenseAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the sense axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the sense axis on.float
- The current sense axis value.The GetButtonSenseAxis method retrieves the current sense axis value for the given button type on the given controller reference.
public override float GetButtonHairlineDelta(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to get the hairline delta for.VRTK_ControllerReference controllerReference
- The reference to the controller to get the hairline delta for.float
- The delta between the button presses.The GetButtonHairlineDelta method is used to get the difference between the current button press and the previous frame button press.
public override bool GetControllerButtonState(ButtonTypes buttonType, ButtonPressTypes pressType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the state of.ButtonPressTypes pressType
- The button state to check for.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button state on.bool
- Returns true if the given button is in the state of the given press type on the given controller reference.The GetControllerButtonState method is used to determine if the given controller button for the given press type on the given controller reference is currently taking place.
The Daydream Boundaries SDK script provides dummy functions for the play area boundaries.
public override void InitBoundaries()
The InitBoundaries method is run on start of scene and can be used to initialse anything on game start.
public override Transform GetPlayArea()
Transform
- A transform of the object representing the play area in the scene.The GetPlayArea method returns the Transform of the object that is used to represent the play area in the scene.
public override Vector3[] GetPlayAreaVertices()
Vector3[]
- A Vector3 array of the points in the scene that represent the play area boundaries.The GetPlayAreaVertices method returns the points of the play area boundaries.
public override float GetPlayAreaBorderThickness()
float
- The thickness of the drawn border.The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
public override bool IsPlayAreaSizeCalibrated()
bool
- Returns true if the play area size has been auto calibrated and set by external sensors.The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
public override bool GetDrawAtRuntime()
bool
- Returns true if the drawn border is being displayed.The GetDrawAtRuntime method returns whether the given play area drawn border is being displayed.
public override void SetDrawAtRuntime(bool value)
bool value
- The state of whether the drawn border should be displayed or not.The SetDrawAtRuntime method sets whether the given play area drawn border should be displayed at runtime.
The scripts used to utilise the Ximmerse SDK for Unity.
Handles all the scripting define symbols for the Ximmerse SDK.
public const string ScriptingDefineSymbol
- The scripting define symbol for the Ximmerse SDK. Default: SDK_ScriptingDefineSymbolPredicateAttribute.RemovableSymbolPrefix + "SDK_XIMMERSE"
The Ximmerse System SDK script provides a bridge to the Ximmerse SDK.
public override bool IsDisplayOnDesktop()
bool
- Returns true if the display is extending the desktopThe IsDisplayOnDesktop method returns true if the display is extending the desktop.
public override bool ShouldAppRenderWithLowResources()
bool
- Returns true if the Unity app should render with low resources.The ShouldAppRenderWithLowResources method is used to determine if the Unity app should use low resource mode. Typically true when the dashboard is showing.
public override void ForceInterleavedReprojectionOn(bool force)
bool force
- If true then Interleaved Reprojection will be forced on, if false it will not be forced on.The ForceInterleavedReprojectionOn method determines whether Interleaved Reprojection should be forced on or off.
The Ximmerse Headset SDK script provides a bridge to the Ximmerse SDK.
public override void ProcessUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void ProcessFixedUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override string GetHeadsetType()
string
- The string of the headset connected.The GetHeadsetType method returns a string representing the type of headset connected.
public override Vector3 GetHeadsetVelocity()
Vector3
- A Vector3 containing the current velocity of the headset.The GetHeadsetVelocity method is used to determine the current velocity of the headset.
public override Vector3 GetHeadsetAngularVelocity()
Vector3
- A Vector3 containing the current angular velocity of the headset.The GetHeadsetAngularVelocity method is used to determine the current angular velocity of the headset.
public override Transform GetHeadset()
Transform
- A transform of the object representing the headset in the scene.The GetHeadset method returns the Transform of the object that is used to represent the headset in the scene.
public override Transform GetHeadsetCamera()
Transform
- A transform of the object holding the headset camera in the scene.The GetHeadsetCamera method returns the Transform of the object that is used to hold the headset camera in the scene.
public override void HeadsetFade(Color color, float duration, bool fadeOverlay = false)
Color color
- The colour to fade to.float duration
- The amount of time the fade should take to reach the given colour.bool fadeOverlay
- Determines whether to use an overlay on the fade.The HeadsetFade method is used to apply a fade to the headset camera to progressively change the colour.
public override bool HasHeadsetFade(Transform obj)
Transform obj
- The Transform to check to see if a camera fade is available on.bool
- Returns true if the headset has fade functionality on it.The HasHeadsetFade method checks to see if the given game object (usually the camera) has the ability to fade the viewpoint.
public override void AddHeadsetFade(Transform camera)
Transform camera
- The Transform to with the camera on to add the fade functionality to.The AddHeadsetFade method attempts to add the fade functionality to the game object with the camera on it.
The Ximmerse Controller SDK script provides a bridge to SDK methods that deal with the input devices.
public override void ProcessUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void ProcessFixedUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override ControllerType GetCurrentControllerType(VRTK_ControllerReference controllerReference = null)
VRTK_ControllerReference controllerReference
- The reference to the controller to get type of.ControllerType
- The ControllerType based on the SDK and headset being used.The GetCurrentControllerType method returns the current used ControllerType based on the SDK and headset being used.
public override string GetControllerDefaultColliderPath(ControllerHand hand)
ControllerHand hand
- The controller hand to check forstring
- A path to the resource that contains the collider GameObject.The GetControllerDefaultColliderPath returns the path to the prefab that contains the collider objects for the default controller of this SDK.
public override string GetControllerElementPath(ControllerElements element, ControllerHand hand, bool fullPath = false)
ControllerElements element
- The controller element to look up.ControllerHand hand
- The controller hand to look up.bool fullPath
- Whether to get the initial path or the full path to the element.string
- A string containing the path to the game object that the controller element resides in.The GetControllerElementPath returns the path to the game object that the given controller element for the given hand resides in.
public override uint GetControllerIndex(GameObject controller)
GameObject controller
- The GameObject containing the controller.uint
- The index of the given controller.The GetControllerIndex method returns the index of the given controller.
public override GameObject GetControllerByIndex(uint index, bool actual = false)
uint index
- The index of the controller to find.bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
-The GetControllerByIndex method returns the GameObject of a controller with a specific index.
public override Transform GetControllerOrigin(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to retrieve the origin from.Transform
- A Transform containing the origin of the controller.The GetControllerOrigin method returns the origin of the given controller.
public override GameObject GetControllerLeftHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the left hand controller.The GetControllerLeftHand method returns the GameObject containing the representation of the left hand controller.
public override GameObject GetControllerRightHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the right hand controller.The GetControllerRightHand method returns the GameObject containing the representation of the right hand controller.
public override bool IsControllerLeftHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/1 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/1 method is used to check if the given controller is the the right hand controller.
public override bool IsControllerLeftHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/2 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/2 method is used to check if the given controller is the the right hand controller.
public override bool WaitForControllerModel(ControllerHand hand)
ControllerHand hand
- The hand to determine if the controller model will be ready for.bool
- Returns true if the controller model requires loading in at runtime and therefore needs waiting for. Returns false if the controller model will be available at start.The WaitForControllerModel method determines whether the controller model for the given hand requires waiting to load in on scene start.
public override GameObject GetControllerModel(GameObject controller)
GameObject controller
- The GameObject to get the model alias for.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given GameObject.
public override GameObject GetControllerModel(ControllerHand hand)
ControllerHand hand
- The hand enum of which controller model to retrieve.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given controller hand.
public override GameObject GetControllerRenderModel(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the controller to check.GameObject
- A GameObject containing the object that has a render model for the controller.The GetControllerRenderModel method gets the game object that contains the given controller's render model.
public override void SetControllerRenderModelWheel(GameObject renderModel, bool state)
GameObject renderModel
- The GameObject containing the controller render model.bool state
- If true and the render model has a scroll wheen then it will be displayed, if false then the scroll wheel will be hidden.The SetControllerRenderModelWheel method sets the state of the scroll wheel on the controller render model.
public override void HapticPulse(VRTK_ControllerReference controllerReference, float strength = 0.5f)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.float strength
- The intensity of the rumble of the controller motor. 0
to 1
.The HapticPulse/2 method is used to initiate a simple haptic pulse on the tracked object of the given controller reference.
public override bool HapticPulse(VRTK_ControllerReference controllerReference, AudioClip clip)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.AudioClip clip
- The audio clip to use for the haptic pattern.The HapticPulse/2 method is used to initiate a haptic pulse based on an audio clip on the tracked object of the given controller reference.
public override SDK_ControllerHapticModifiers GetHapticModifiers()
SDK_ControllerHapticModifiers
- An SDK_ControllerHapticModifiers object with a given durationModifier
and an intervalModifier
.The GetHapticModifiers method is used to return modifiers for the duration and interval if the SDK handles it slightly differently.
public override Vector3 GetVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current velocity of the tracked object.The GetVelocity method is used to determine the current velocity of the tracked object on the given controller reference.
public override Vector3 GetAngularVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current angular velocity of the tracked object.The GetAngularVelocity method is used to determine the current angular velocity of the tracked object on the given controller reference.
public override bool IsTouchpadStatic(bool isTouched, Vector2 currentAxisValues, Vector2 previousAxisValues, int compareFidelity)
Vector2 currentAxisValues
-Vector2 previousAxisValues
-int compareFidelity
-bool
- Returns true if the touchpad is not currently being touched or moved.The IsTouchpadStatic method is used to determine if the touchpad is currently not being moved.
public override Vector2 GetButtonAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button axis on.Vector2
- A Vector2 of the X/Y values of the button axis. If no axis values exist for the given button, then a Vector2.Zero is returned.The GetButtonAxis method retrieves the current X/Y axis values for the given button type on the given controller reference.
public override float GetButtonSenseAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the sense axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the sense axis on.float
- The current sense axis value.The GetButtonSenseAxis method retrieves the current sense axis value for the given button type on the given controller reference.
public override float GetButtonHairlineDelta(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to get the hairline delta for.VRTK_ControllerReference controllerReference
- The reference to the controller to get the hairline delta for.float
- The delta between the button presses.The GetButtonHairlineDelta method is used to get the difference between the current button press and the previous frame button press.
public override bool GetControllerButtonState(ButtonTypes buttonType, ButtonPressTypes pressType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the state of.ButtonPressTypes pressType
- The button state to check for.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button state on.bool
- Returns true if the given button is in the state of the given press type on the given controller reference.The GetControllerButtonState method is used to determine if the given controller button for the given press type on the given controller reference is currently taking place.
The Ximmerse Boundaries SDK script provides a bridge to the Ximmerse SDK play area.
public override void InitBoundaries()
The InitBoundaries method is run on start of scene and can be used to initialse anything on game start.
public override Transform GetPlayArea()
Transform
- A transform of the object representing the play area in the scene.The GetPlayArea method returns the Transform of the object that is used to represent the play area in the scene.
public override Vector3[] GetPlayAreaVertices()
Vector3[]
- A Vector3 array of the points in the scene that represent the play area boundaries.The GetPlayAreaVertices method returns the points of the play area boundaries.
public override float GetPlayAreaBorderThickness()
float
- The thickness of the drawn border.The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
public override bool IsPlayAreaSizeCalibrated()
bool
- Returns true if the play area size has been auto calibrated and set by external sensors.The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
public override bool GetDrawAtRuntime()
bool
- Returns true if the drawn border is being displayed.The GetDrawAtRuntime method returns whether the given play area drawn border is being displayed.
public override void SetDrawAtRuntime(bool value)
bool value
- The state of whether the drawn border should be displayed or not.The SetDrawAtRuntime method sets whether the given play area drawn border should be displayed at runtime.
The scripts used to utilise the HyperealVR SDK for Unity.
Handles all the scripting define symbols for the Hypereal SDK.
public const string ScriptingDefineSymbol
- The scripting define symbol for the Hypereal SDK. Default: SDK_ScriptingDefineSymbolPredicateAttribute.RemovableSymbolPrefix +
The HyperealVR System SDK script provides a bridge to the HyperealVR SDK.
public override bool IsDisplayOnDesktop()
bool
- Returns true if the display is extending the desktopThe IsDisplayOnDesktop method returns true if the display is extending the desktop.
public override bool ShouldAppRenderWithLowResources()
bool
- Returns true if the Unity app should render with low resources.The ShouldAppRenderWithLowResources method is used to determine if the Unity app should use low resource mode. Typically true when the dashboard is showing.
public override void ForceInterleavedReprojectionOn(bool force)
bool force
- If true then Interleaved Reprojection will be forced on, if false it will not be forced on.The ForceInterleavedReprojectionOn method determines whether Interleaved Reprojection should be forced on or off.
The HyperealVR Headset SDK script provides a bridge to the HyperealVR SDK.
public override void ProcessUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void ProcessFixedUpdate(Dictionary<string, object> options)
Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override Transform GetHeadset()
Transform
- A transform of the object representing the headset in the scene.The GetHeadset method returns the Transform of the object that is used to represent the headset in the scene.
public override Transform GetHeadsetCamera()
Transform
- A transform of the object holding the headset camera in the scene.The GetHeadsetCamera method returns the Transform of the object that is used to hold the headset camera in the scene.
public override string GetHeadsetType()
string
- The string of the headset connected.The GetHeadsetType method returns a string representing the type of headset connected.
public override Vector3 GetHeadsetVelocity()
Vector3
- A Vector3 containing the current velocity of the headset.The GetHeadsetVelocity method is used to determine the current velocity of the headset.
public override Vector3 GetHeadsetAngularVelocity()
Vector3
- A Vector3 containing the current angular velocity of the headset.The GetHeadsetAngularVelocity method is used to determine the current angular velocity of the headset.
public override void HeadsetFade(Color color, float duration, bool fadeOverlay = false)
Color color
- The colour to fade to.float duration
- The amount of time the fade should take to reach the given colour.bool fadeOverlay
- Determines whether to use an overlay on the fade.The HeadsetFade method is used to apply a fade to the headset camera to progressively change the colour.
public override bool HasHeadsetFade(Transform obj)
Transform obj
- The Transform to check to see if a camera fade is available on.bool
- Returns true if the headset has fade functionality on it.The HasHeadsetFade method checks to see if the given game object (usually the camera) has the ability to fade the viewpoint.
public override void AddHeadsetFade(Transform camera)
Transform camera
- The Transform to with the camera on to add the fade functionality to.The AddHeadsetFade method attempts to add the fade functionality to the game object with the camera on it.
The HyperealVR Controller SDK script provides a bridge to SDK methods that deal with the input devices.
public override void ProcessUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.The ProcessUpdate method enables an SDK to run logic for every Unity Update
public override void ProcessFixedUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
public override ControllerType GetCurrentControllerType(VRTK_ControllerReference controllerReference = null)
VRTK_ControllerReference controllerReference
- The reference to the controller to get type of.ControllerType
- The ControllerType based on the SDK and headset being used.The GetCurrentControllerType method returns the current used ControllerType based on the SDK and headset being used.
public override string GetControllerDefaultColliderPath(ControllerHand hand)
ControllerHand hand
- The controller hand to check forstring
- A path to the resource that contains the collider GameObject.The GetControllerDefaultColliderPath returns the path to the prefab that contains the collider objects for the default controller of this SDK.
public override string GetControllerElementPath(ControllerElements element, ControllerHand hand, bool fullPath = false)
ControllerElements element
- The controller element to look up.ControllerHand hand
- The controller hand to look up.bool fullPath
- Whether to get the initial path or the full path to the element.string
- A string containing the path to the game object that the controller element resides in.The GetControllerElementPath returns the path to the game object that the given controller element for the given hand resides in.
public override uint GetControllerIndex(GameObject controller)
GameObject controller
- The GameObject containing the controller.uint
- The index of the given controller.The GetControllerIndex method returns the index of the given controller.
public override GameObject GetControllerByIndex(uint index, bool actual = false)
uint index
- The index of the controller to find.bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject of the controllerThe GetControllerByIndex method returns the GameObject of a controller with a specific index.
public override Transform GetControllerOrigin(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The controller to retrieve the origin from.Transform
- A Transform containing the origin of the controller.The GetControllerOrigin method returns the origin of the given controller.
public override GameObject GetControllerLeftHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the left hand controller.The GetControllerLeftHand method returns the GameObject containing the representation of the left hand controller.
public override GameObject GetControllerRightHand(bool actual = false)
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.GameObject
- The GameObject containing the right hand controller.The GetControllerRightHand method returns the GameObject containing the representation of the right hand controller.
public override bool IsControllerLeftHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/1 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller)
GameObject controller
- The GameObject to check.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/1 method is used to check if the given controller is the the right hand controller.
public override bool IsControllerLeftHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the left hand controller.The IsControllerLeftHand/2 method is used to check if the given controller is the the left hand controller.
public override bool IsControllerRightHand(GameObject controller, bool actual)
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.bool
- Returns true if the given controller is the right hand controller.The IsControllerRightHand/2 method is used to check if the given controller is the the right hand controller.
public override bool WaitForControllerModel(ControllerHand hand)
ControllerHand hand
- The hand to determine if the controller model will be ready for.bool
- Returns true if the controller model requires loading in at runtime and therefore needs waiting for. Returns false if the controller model will be available at start.The WaitForControllerModel method determines whether the controller model for the given hand requires waiting to load in on scene start.
public override GameObject GetControllerModel(GameObject controller)
GameObject controller
- The GameObject to get the model alias for.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given GameObject.
public override GameObject GetControllerModel(ControllerHand hand)
ControllerHand hand
- The hand enum of which controller model to retrieve.GameObject
- The GameObject that has the model alias within it.The GetControllerModel method returns the model alias for the given controller hand.
public override GameObject GetControllerRenderModel(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The GameObject to check.GameObject
- A GameObject containing the object that has a render model for the controller.The GetControllerRenderModel method gets the game object that contains the given controller's render model.
public override void SetControllerRenderModelWheel(GameObject renderModel, bool state)
GameObject renderModel
- The GameObject containing the controller render model.bool state
- If true and the render model has a scroll wheen then it will be displayed, if false then the scroll wheel will be hidden.The SetControllerRenderModelWheel method sets the state of the scroll wheel on the controller render model.
public override void HapticPulse(VRTK_ControllerReference controllerReference, float strength = 0.5f)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.float strength
- The intensity of the rumble of the controller motor. 0
to 1
.The HapticPulse/2 method is used to initiate a simple haptic pulse on the tracked object of the given controller reference.
public override bool HapticPulse(VRTK_ControllerReference controllerReference, AudioClip clip)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.AudioClip clip
- The audio clip to use for the haptic pattern.The HapticPulse/2 method is used to initiate a haptic pulse based on an audio clip on the tracked object of the given controller reference.
public override SDK_ControllerHapticModifiers GetHapticModifiers()
SDK_ControllerHapticModifiers
- An SDK_ControllerHapticModifiers object with a given durationModifier
and an intervalModifier
.The GetHapticModifiers method is used to return modifiers for the duration and interval if the SDK handles it slightly differently.
public override Vector3 GetVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current velocity of the tracked object.The GetVelocity method is used to determine the current velocity of the tracked object on the given controller reference.
public override Vector3 GetAngularVelocity(VRTK_ControllerReference controllerReference)
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.Vector3
- A Vector3 containing the current angular velocity of the tracked object.The GetAngularVelocity method is used to determine the current angular velocity of the tracked object on the given controller reference.
public override bool IsTouchpadStatic(bool isTouched, Vector2 currentAxisValues, Vector2 previousAxisValues, int compareFidelity)
Vector2 currentAxisValues
-Vector2 previousAxisValues
-int compareFidelity
-bool
- Returns true if the touchpad is not currently being touched or moved.The IsTouchpadStatic method is used to determine if the touchpad is currently not being moved.
public override Vector2 GetButtonAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button axis on.Vector2
- A Vector2 of the X/Y values of the button axis. If no axis values exist for the given button, then a Vector2.Zero is returned.The GetButtonAxis method retrieves the current X/Y axis values for the given button type on the given controller reference.
public override float GetButtonSenseAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the sense axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the sense axis on.float
- The current sense axis value.The GetButtonSenseAxis method retrieves the current sense axis value for the given button type on the given controller reference.
public override float GetButtonHairlineDelta(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to get the hairline delta for.VRTK_ControllerReference controllerReference
- The reference to the controller to get the hairline delta for.float
- The delta between the button presses.The GetButtonHairlineDelta method is used to get the difference between the current button press and the previous frame button press.
public override bool GetControllerButtonState(ButtonTypes buttonType, ButtonPressTypes pressType, VRTK_ControllerReference controllerReference)
ButtonTypes buttonType
- The type of button to check for the state of.ButtonPressTypes pressType
- The button state to check for.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button state on.bool
- Returns true if the given button is in the state of the given press type on the given controller reference.The GetControllerButtonState method is used to determine if the given controller button for the given press type on the given controller reference is currently taking place.
The HyperealVR Boundaries SDK script provides a bridge to the HyperealVR SDK play area.
public override void InitBoundaries()
The InitBoundaries method is run on start of scene and can be used to initialse anything on game start.
public override Transform GetPlayArea()
Transform
- A transform of the object representing the play area in the scene.The GetPlayArea method returns the Transform of the object that is used to represent the play area in the scene.
public override Vector3[] GetPlayAreaVertices()
Vector3[]
- A Vector3 array of the points in the scene that represent the play area boundaries.The GetPlayAreaVertices method returns the points of the play area boundaries.
public override float GetPlayAreaBorderThickness()
float
- The thickness of the drawn border.The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
public override bool IsPlayAreaSizeCalibrated()
bool
- Returns true if the play area size has been auto calibrated and set by external sensors.The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
public override bool GetDrawAtRuntime()
bool
- Returns true if the drawn border is being displayed.The GetDrawAtRuntime method returns whether the given play area drawn border is being displayed.
public override void SetDrawAtRuntime(bool value)
bool value
- The state of whether the drawn border should be displayed or not.The SetDrawAtRuntime method sets whether the given play area drawn border should be displayed at runtime.