VRTK_PlayAreaCursor
Overview
The Play Area Cursor is used in conjunction with a Pointer script and displays a representation of the play area where the pointer cursor hits.
Inspector Parameters
- Play Area Cursor Dimensions: Determines the size of the play area cursor and collider. If the values are left as zero then the Play Area Cursor will be sized to the calibrated Play Area space.
- Handle Play Area Cursor Collisions: If this is ticked then if the play area cursor is colliding with any other object then the pointer colour will change to the
Pointer Miss Color
and theDestinationMarkerSet
event will not be triggered, which will prevent teleporting into areas where the play area will collide. - Headset Out Of Bounds Is Collision: If this is ticked then if the user's headset is outside of the play area cursor bounds then it is considered a collision even if the play area isn't colliding with anything.
- Target List Policy: A specified VRTK_PolicyList to use to determine whether the play area cursor collisions will be acted upon.
Class Methods
HasCollided/0
public virtual bool HasCollided()
- Parameters
- none
- Returns
bool
- A bool to determine the state of collision.true
if the play area is colliding with a valid object andfalse
if not.
The HasCollided method returns the state of whether the play area cursor has currently collided with another valid object.
SetHeadsetPositionCompensation/1
public virtual void SetHeadsetPositionCompensation(bool state)
- Parameters
bool state
- The state of whether to take the position of the headset within the play area into account when setting the destination marker.- Returns
- none
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.
SetPlayAreaCursorCollision/1
public virtual void SetPlayAreaCursorCollision(bool state)
- Parameters
bool state
- The state of whether to check for play area collisions.- Returns
- none
The SetPlayAreaCursorCollision method determines whether play area collisions should be taken into consideration with the play area cursor.
SetMaterialColor/1
public virtual void SetMaterialColor(Color color)
- Parameters
Color color
- The colour to update the play area cursor material to.- Returns
- none
The SetMaterialColor method sets the current material colour on the play area cursor.
SetPlayAreaCursorTransform/1
public virtual void SetPlayAreaCursorTransform(Vector3 location)
- Parameters
Vector3 location
- The location where to draw the play area cursor.- Returns
- none
The SetPlayAreaCursorTransform method is used to update the position of the play area cursor in world space to the given location.
ToggleState/1
public virtual void ToggleState(bool state)
- Parameters
bool state
- The state of whether to show or hide the play area cursor.- Returns
- none
The ToggleState method enables or disables the visibility of the play area cursor.
IsActive/0
public virtual bool IsActive()
- Parameters
- none
- Returns
bool
- Returns true if the play area cursor GameObject is active.
The IsActive method returns whether the play area cursor game object is active or not.
GetPlayAreaContainer/0
public virtual GameObject GetPlayAreaContainer()
- Parameters
- none
- Returns
GameObject
- The GameObject that is the container of the play area cursor.
The GetPlayAreaContainer method returns the created game object that holds the play area cursor representation.
ToggleVisibility/1
public virtual void ToggleVisibility(bool state)
- Parameters
bool state
- The state of the cursor visibility. True will show the renderers and false will hide the renderers.- Returns
- none
The ToggleVisibility method enables or disables the play area cursor renderers to allow the cursor to be seen or hidden.
Example
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.
Updated less than a minute ago