Provides a visual representation of the play area boundaries that tracks to the cursor position of a pointer.
VRTK_PointerDirectionIndicator- A Pointer Direction Indicator to set the cursor rotation to.
- Place the
VRTK_PlayAreaCursorscript on the same GameObject as the Pointer Renderer script it is linked to.
- Link the required Play Area Cursor script to the
Playarea Cursorparameter on the required Pointer Renderer script.
- A Base Pointer Renderer script attached to a valid Pointer script is required so the PlayArea Cursor script can be linked to follow the valid Base Pointer Renderer cursor GameObject.
- Use Pointer Color: If this is checked then the pointer valid/invalid colours will also be used to change the colour of the play area cursor when colliding/not colliding.
- 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 checked then if the play area cursor is colliding with any other object then the pointer colour will change to the
Pointer Miss Colorand the
DestinationMarkerSetevent 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 checked 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.
- Display On Invalid Location: If this is checked then the play area cursor will be displayed when the location is invalid.
- Target List Policy: A specified VRTK_PolicyList to use to determine whether the play area cursor collisions will be acted upon.
- Direction Indicator: A custom Pointer Direction Indicator to use to determine the rotation of the Play Area Cursor.
- Valid Location Object: A custom GameObject to use for the play area cursor representation for when the location is valid.
- Invalid Location Object: A custom GameObject to use for the play area cursor representation for when the location is invalid.
PlayAreaCursorStartCollision- Emitted when the play area collides with another object.
PlayAreaCursorEndCollision- Emitted when the play area stops colliding with another object.
VRTK_PlayAreaCursor_UnityEvents component to
VRTK_PlayAreaCursor object allows access to
UnityEvents that will react identically to the Class Events.
- All C# delegate events are mapped to a Unity Event with the
collidedWith- The collider that is/was being collided with.
public virtual bool HasCollided()
trueif the play area is colliding with a valid object and
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()
trueif 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.
Updated less than a minute ago