{"_id":"594949e62be16d0026ec04ef","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"},"user":"571fa519db52d01700f5cf3d","parentDoc":null,"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:36.591Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"## Overview\n\nThe purpose of the Headset Fade is to change the colour of the headset view to a specified colour over a given duration and to also unfade it back to being transparent.\n\nThe `Fade` and `Unfade` methods can only be called via another script and this Headset Fade script does not do anything on initialisation to fade or unfade the headset view.\n\n## Class Events\n\n * `HeadsetFadeStart` - Emitted when the user's headset begins to fade to a given colour.\n * `HeadsetFadeComplete` - Emitted when the user's headset has completed the fade and is now fully at the given colour.\n * `HeadsetUnfadeStart` - Emitted when the user's headset begins to unfade back to a transparent colour.\n * `HeadsetUnfadeComplete` - Emitted when the user's headset has completed unfading and is now fully transparent again.\n\n## Unity Events\n\nAdding the `VRTK_HeadsetFade_UnityEvents` component to `VRTK_HeadsetFade` 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 * `float timeTillComplete` - A float that is the duration for the fade/unfade process has remaining.\n * `Transform currentTransform` - The current Transform of the object that the Headset Fade script is attached to (Camera).\n\n## Class Methods\n\n### IsFaded/0\n\n  > `public virtual bool IsFaded()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * `bool` - Returns true if the headset is currently fading or faded.\n\nThe IsFaded method returns true if the headset is currently fading or has completely faded and returns false if it is completely unfaded.\n\n### IsTransitioning/0\n\n  > `public virtual bool IsTransitioning()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * `bool` - Returns true if the headset is currently in the process of fading or unfading.\n\nThe IsTransitioning method returns true if the headset is currently fading or unfading and returns false if it is completely faded or unfaded.\n\n### Fade/2\n\n  > `public virtual void Fade(Color color, float duration)`\n\n  * Parameters\n   * `Color color` - The colour to fade the headset view to.\n   * `float duration` - The time in seconds to take to complete the fade transition.\n  * Returns\n   * _none_\n\nThe Fade method initiates a change in the colour of the headset view to the given colour over a given duration.\n\n### Unfade/1\n\n  > `public virtual void Unfade(float duration)`\n\n  * Parameters\n   * `float duration` - The time in seconds to take to complete the unfade transition.\n  * Returns\n   * _none_\n\nThe Unfade method initiates the headset to change colour back to a transparent colour over a given duration.\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_headsetfade","type":"basic","title":"VRTK_HeadsetFade"}
## Overview The purpose of the Headset Fade is to change the colour of the headset view to a specified colour over a given duration and to also unfade it back to being transparent. The `Fade` and `Unfade` methods can only be called via another script and this Headset Fade script does not do anything on initialisation to fade or unfade the headset view. ## Class Events * `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. ## Unity Events Adding the `VRTK_HeadsetFade_UnityEvents` component to `VRTK_HeadsetFade` 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 * `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). ## Class Methods ### IsFaded/0 > `public virtual bool IsFaded()` * Parameters * _none_ * Returns * `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. ### IsTransitioning/0 > `public virtual bool IsTransitioning()` * Parameters * _none_ * Returns * `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. ### Fade/2 > `public virtual void Fade(Color color, float duration)` * Parameters * `Color color` - The colour to fade the headset view to. * `float duration` - The time in seconds to take to complete the fade transition. * Returns * _none_ The Fade method initiates a change in the colour of the headset view to the given colour over a given duration. ### Unfade/1 > `public virtual void Unfade(float duration)` * Parameters * `float duration` - The time in seconds to take to complete the unfade transition. * Returns * _none_ The Unfade method initiates the headset to change colour back to a transparent colour over a given duration. ## 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.