{"_id":"594949e82be16d0026ec052c","category":{"_id":"594949e62be16d0026ec04d0","version":"594949e52be16d0026ec04cd","project":"571fa55ca0acd42000af9545","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-01-01T16:38:26.097Z","from_sync":false,"order":2,"slug":"pointers","title":"Pointers"},"project":"571fa55ca0acd42000af9545","parentDoc":null,"user":"571fa519db52d01700f5cf3d","version":{"_id":"594949e52be16d0026ec04cd","project":"571fa55ca0acd42000af9545","__v":2,"createdAt":"2017-06-20T16:14:29.816Z","releaseDate":"2017-06-20T16:14:29.816Z","categories":["594949e62be16d0026ec04ce","594949e62be16d0026ec04cf","594949e62be16d0026ec04d0","594949e62be16d0026ec04d1","594949e62be16d0026ec04d2","594949e62be16d0026ec04d3","594949e62be16d0026ec04d4","594949e62be16d0026ec04d5","594949e62be16d0026ec04d6","594949e62be16d0026ec04d7","594949e62be16d0026ec04d8","594949e62be16d0026ec04d9","594949e62be16d0026ec04da","594949e62be16d0026ec04db","594949e62be16d0026ec04dc","594949e62be16d0026ec04dd","594949e62be16d0026ec04de","594949e62be16d0026ec04df","594949e62be16d0026ec04e0","594949e62be16d0026ec04e1","59497219f4a8980024dd0631"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Kunekune","version_clean":"3.2.0","version":"3.2.0"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-01-01T16:39:58.970Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"## Overview\n\nThe Play Area Cursor is used in conjunction with a Pointer script and displays a representation of the play area where the pointer cursor hits.\n\n## Inspector Parameters\n\n * **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.\n * **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.\n * **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 Color` and the `DestinationMarkerSet` event will not be triggered, which will prevent teleporting into areas where the play area will collide.\n * **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.\n * **Display On Invalid Location:** If this is checked then the play area cursor will be displayed when the location is invalid.\n * **Target List Policy:** A specified VRTK_PolicyList to use to determine whether the play area cursor collisions will be acted upon.\n * **Valid Location Object:** A custom GameObject to use for the play area cursor representation for when the location is valid.\n * **Invalid Location Object:** A custom GameObject to use for the play area cursor representation for when the location is invalid.\n\n## Class Events\n\n * `PlayAreaCursorStartCollision` - Emitted when the play area collides with another object.\n * `PlayAreaCursorEndCollision` - Emitted when the play area stops colliding with another object.\n\n## Unity Events\n\nAdding the `VRTK_PlayAreaCursor_UnityEvents` component to `VRTK_PlayAreaCursor` object allows access to `UnityEvents` that will react identically to the Class Events.\n\n * All C# delegate events are mapped to a Unity Event with the `On` prefix. e.g. `MyEvent` -> `OnMyEvent`.\n\n## Event Payload\n\n * ` collidedWith` - The collider that is/was being collided with.\n\n## Class Methods\n\n### HasCollided/0\n\n  > `public virtual bool HasCollided()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * `bool` - A bool to determine the state of collision. `true` if the play area is colliding with a valid object and `false` if not.\n\nThe HasCollided method returns the state of whether the play area cursor has currently collided with another valid object.\n\n### SetHeadsetPositionCompensation/1\n\n  > `public virtual void SetHeadsetPositionCompensation(bool state)`\n\n  * Parameters\n   * `bool state` - The state of whether to take the position of the headset within the play area into account when setting the destination marker.\n  * Returns\n   * _none_\n\nThe 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.\n\n### SetPlayAreaCursorCollision/2\n\n  > `public virtual void SetPlayAreaCursorCollision(bool state, Collider collider = null)`\n\n  * Parameters\n   * `bool state` - The state of whether to check for play area collisions.\n   * `Collider collider` - The state of whether to check for play area collisions.\n  * Returns\n   * _none_\n\nThe SetPlayAreaCursorCollision method determines whether play area collisions should be taken into consideration with the play area cursor.\n\n### SetMaterialColor/2\n\n  > `public virtual void SetMaterialColor(Color color, bool validity)`\n\n  * Parameters\n   * `Color color` - The colour to update the play area cursor material to.\n   * `bool validity` - Determines if the colour being set is based from a valid location or invalid location.\n  * Returns\n   * _none_\n\nThe SetMaterialColor method sets the current material colour on the play area cursor.\n\n### SetPlayAreaCursorTransform/1\n\n  > `public virtual void SetPlayAreaCursorTransform(Vector3 location)`\n\n  * Parameters\n   * `Vector3 location` - The location where to draw the play area cursor.\n  * Returns\n   * _none_\n\nThe SetPlayAreaCursorTransform method is used to update the position of the play area cursor in world space to the given location.\n\n### ToggleState/1\n\n  > `public virtual void ToggleState(bool state)`\n\n  * Parameters\n   * `bool state` - The state of whether to show or hide the play area cursor.\n  * Returns\n   * _none_\n\nThe ToggleState method enables or disables the visibility of the play area cursor.\n\n### IsActive/0\n\n  > `public virtual bool IsActive()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * `bool` - Returns true if the play area cursor GameObject is active.\n\nThe IsActive method returns whether the play area cursor game object is active or not.\n\n### GetPlayAreaContainer/0\n\n  > `public virtual GameObject GetPlayAreaContainer()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * `GameObject` - The GameObject that is the container of the play area cursor.\n\nThe GetPlayAreaContainer method returns the created game object that holds the play area cursor representation.\n\n### ToggleVisibility/1\n\n  > `public virtual void ToggleVisibility(bool state)`\n\n  * Parameters\n   * `bool state` - The state of the cursor visibility. True will show the renderers and false will hide the renderers.\n  * Returns\n   * _none_\n\nThe ToggleVisibility method enables or disables the play area cursor renderers to allow the cursor to be seen or hidden.\n\n## Example\n\n`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.","excerpt":"","slug":"vrtk_playareacursor","type":"basic","title":"VRTK_PlayAreaCursor"}

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 * **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 Color` and the `DestinationMarkerSet` 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 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. * **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. ## Class Events * `PlayAreaCursorStartCollision` - Emitted when the play area collides with another object. * `PlayAreaCursorEndCollision` - Emitted when the play area stops colliding with another object. ## Unity Events Adding the `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 `On` prefix. e.g. `MyEvent` -> `OnMyEvent`. ## Event Payload * ` collidedWith` - The collider that is/was being collided with. ## 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 and `false` 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/2 > `public virtual void SetPlayAreaCursorCollision(bool state, Collider collider = null)` * Parameters * `bool state` - The state of whether to check for play area collisions. * `Collider collider` - 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/2 > `public virtual void SetMaterialColor(Color color, bool validity)` * Parameters * `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. * 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.