{"_id":"594949e62be16d0026ec04ee","category":{"_id":"594949e62be16d0026ec04d8","version":"594949e52be16d0026ec04cd","project":"571fa55ca0acd42000af9545","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-01-01T16:58:11.374Z","from_sync":false,"order":10,"slug":"presence","title":"Presence"},"parentDoc":null,"user":"571fa519db52d01700f5cf3d","project":"571fa55ca0acd42000af9545","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:58:27.193Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"## Overview\n\nThe purpose of the Headset Collision is to detect when the user's VR headset collides with another game object.\n\nThe Headset Collision script will automatically create a script on the headset to deal with the collision events.\n\n## Inspector Parameters\n\n * **Ignore Trigger Colliders:** If this is checked then the headset collision will ignore colliders set to `Is Trigger = true`.\n * **Collider Radius:** The radius of the auto generated sphere collider for detecting collisions on the headset.\n * **Target List Policy:** A specified VRTK_PolicyList to use to determine whether any objects will be acted upon by the Headset Collision.\n\n## Class Variables\n\n * `public bool headsetColliding` - Determines if the headset is currently colliding with another object. Default: `false`\n * `public Collider collidingWith` - Stores the collider of what the headset is colliding with. Default: `null`\n\n## Class Events\n\n * `HeadsetCollisionDetect` - Emitted when the user's headset collides with another game object.\n * `HeadsetCollisionEnded` - Emitted when the user's headset stops colliding with a game object.\n\n## Unity Events\n\nAdding the `VRTK_HeadsetCollision_UnityEvents` component to `VRTK_HeadsetCollision` 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 * `Collider collider` - The Collider of the game object the headset has collided with.\n * `Transform currentTransform` - The current Transform of the object that the Headset Collision Fade script is attached to (Camera).\n\n## Class Methods\n\n### IsColliding/0\n\n  > `public virtual bool IsColliding()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * `bool` - Returns true if the headset is currently colliding with a valid game object.\n\nThe 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.\n\n### GetHeadsetColliderContainer/0\n\n  > `public virtual GameObject GetHeadsetColliderContainer()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * `GameObject` - The auto generated headset collider GameObject.\n\nThe GetHeadsetColliderContainer method returns the auto generated GameObject that contains the headset collider.\n\n## Example\n\n`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.","excerpt":"","slug":"vrtk_headsetcollision","type":"basic","title":"VRTK_HeadsetCollision"}

VRTK_HeadsetCollision


## Overview The purpose of the Headset Collision is to detect when the user's VR headset collides with another game object. The Headset Collision script will automatically create a script on the headset to deal with the collision events. ## Inspector Parameters * **Ignore Trigger Colliders:** If this is checked then the headset collision will ignore colliders set to `Is Trigger = true`. * **Collider Radius:** The radius of the auto generated sphere collider for detecting collisions on the headset. * **Target List Policy:** A specified VRTK_PolicyList to use to determine whether any objects will be acted upon by the Headset Collision. ## Class Variables * `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` ## Class Events * `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. ## Unity Events Adding the `VRTK_HeadsetCollision_UnityEvents` component to `VRTK_HeadsetCollision` 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 * `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). ## Class Methods ### IsColliding/0 > `public virtual bool IsColliding()` * Parameters * _none_ * Returns * `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. ### GetHeadsetColliderContainer/0 > `public virtual GameObject GetHeadsetColliderContainer()` * Parameters * _none_ * Returns * `GameObject` - The auto generated headset collider GameObject. The GetHeadsetColliderContainer method returns the auto generated GameObject that contains the headset collider. ## Example `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.