{"__v":0,"_id":"58796782cd4a9c37007c973a","category":{"version":"58796781cd4a9c37007c96ef","project":"571fa55ca0acd42000af9545","_id":"58796781cd4a9c37007c96fb","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-01-01T17:01:47.129Z","from_sync":false,"order":13,"slug":"utilities","title":"Utilities"},"parentDoc":null,"project":"571fa55ca0acd42000af9545","user":"571fa519db52d01700f5cf3d","version":{"__v":4,"_id":"58796781cd4a9c37007c96ef","project":"571fa55ca0acd42000af9545","createdAt":"2017-01-13T23:49:21.393Z","releaseDate":"2017-01-13T23:49:21.393Z","categories":["58796781cd4a9c37007c96f0","58796781cd4a9c37007c96f1","58796781cd4a9c37007c96f2","58796781cd4a9c37007c96f3","58796781cd4a9c37007c96f4","58796781cd4a9c37007c96f5","58796781cd4a9c37007c96f6","58796781cd4a9c37007c96f7","58796781cd4a9c37007c96f8","58796781cd4a9c37007c96f9","58796781cd4a9c37007c96fa","58796781cd4a9c37007c96fb","58796781cd4a9c37007c96fc","58796781cd4a9c37007c96fd","58796781cd4a9c37007c96fe","58796781cd4a9c37007c96ff","58796781cd4a9c37007c9700","58b157ca1756cf370022f90d","58b1596f5dae732f00adeca2","58b1605a5dae732f00adecb1"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Mukota","version_clean":"3.1.0","version":"3.1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-01-01T17:02:32.886Z","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 Shared Methods script is a collection of reusable static methods that are used across a range of different scripts.\n\n## Class Methods\n\n### GetBounds/3\n\n  > `public static Bounds GetBounds(Transform transform, Transform excludeRotation = null, Transform excludeTransform = null)`\n\n  * Parameters\n   * `Transform transform` -\n   * `Transform excludeRotation` - Resets the rotation of the transform temporarily to 0 to eliminate skewed bounds.\n   * `Transform excludeTransform` - Does not consider the stated object when calculating the bounds.\n  * Returns\n   * `Bounds` - The bounds of the transform.\n\nThe GetBounds methods returns the bounds of the transform including all children in world space.\n\n### IsLowest/2\n\n  > `public static bool IsLowest(float value, float[] others)`\n\n  * Parameters\n   * `float value` - The value to check to see if it is lowest.\n   * `float[] others` - The array of values to check against.\n  * Returns\n   * `bool` - Returns true if the value is lower than all numbers in the given array, returns false if it is not the lowest.\n\nThe IsLowest method checks to see if the given value is the lowest number in the given array of values.\n\n### AddCameraFade/0\n\n  > `public static Transform AddCameraFade()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * `Transform` - The transform of the headset camera.\n\nThe AddCameraFade method finds the headset camera and adds a headset fade script to it.\n\n### CreateColliders/1\n\n  > `public static void CreateColliders(GameObject obj)`\n\n  * Parameters\n   * `GameObject obj` - The game object to attempt to add the colliders to.\n  * Returns\n   * _none_\n\nThe CreateColliders method attempts to add box colliders to all child objects in the given object that have a renderer but no collider.\n\n### CloneComponent/3\n\n  > `public static Component CloneComponent(Component source, GameObject destination, bool copyProperties = false)`\n\n  * Parameters\n   * `Component source` - The component to copy.\n   * `GameObject destination` - The game object to copy the component to.\n   * `bool copyProperties` - Determines whether the properties of the component as well as the fields should be copied.\n  * Returns\n   * `Component` - The component that has been cloned onto the given game object.\n\nThe CloneComponent method takes a source component and copies it to the given destination game object.\n\n### ColorDarken/2\n\n  > `public static Color ColorDarken(Color color, float percent)`\n\n  * Parameters\n   * `Color color` - The source colour to apply the darken to.\n   * `float percent` - The percent to darken the colour by.\n  * Returns\n   * `Color` - The new colour with the darken applied.\n\nThe ColorDarken method takes a given colour and darkens it by the given percentage.\n\n### IsEditTime/0\n\n  > `public static bool IsEditTime()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * `bool` - Returns true if Unity is in the Unity Editor and not in play mode.\n\nThe IsEditTime method determines if the state of Unity is in the Unity Editor and the scene is not in play mode.","excerpt":"","slug":"vrtk_sharedmethods","type":"basic","title":"VRTK_SharedMethods"}

VRTK_SharedMethods


## Overview The Shared Methods script is a collection of reusable static methods that are used across a range of different scripts. ## Class Methods ### GetBounds/3 > `public static Bounds GetBounds(Transform transform, Transform excludeRotation = null, Transform excludeTransform = null)` * Parameters * `Transform transform` - * `Transform excludeRotation` - Resets the rotation of the transform temporarily to 0 to eliminate skewed bounds. * `Transform excludeTransform` - Does not consider the stated object when calculating the bounds. * Returns * `Bounds` - The bounds of the transform. The GetBounds methods returns the bounds of the transform including all children in world space. ### IsLowest/2 > `public static bool IsLowest(float value, float[] others)` * Parameters * `float value` - The value to check to see if it is lowest. * `float[] others` - The array of values to check against. * Returns * `bool` - Returns true if the value is lower than all numbers in the given array, returns false if it is not the lowest. The IsLowest method checks to see if the given value is the lowest number in the given array of values. ### AddCameraFade/0 > `public static Transform AddCameraFade()` * Parameters * _none_ * Returns * `Transform` - The transform of the headset camera. The AddCameraFade method finds the headset camera and adds a headset fade script to it. ### CreateColliders/1 > `public static void CreateColliders(GameObject obj)` * Parameters * `GameObject obj` - The game object to attempt to add the colliders to. * Returns * _none_ The CreateColliders method attempts to add box colliders to all child objects in the given object that have a renderer but no collider. ### CloneComponent/3 > `public static Component CloneComponent(Component source, GameObject destination, bool copyProperties = false)` * Parameters * `Component source` - The component to copy. * `GameObject destination` - The game object to copy the component to. * `bool copyProperties` - Determines whether the properties of the component as well as the fields should be copied. * Returns * `Component` - The component that has been cloned onto the given game object. The CloneComponent method takes a source component and copies it to the given destination game object. ### ColorDarken/2 > `public static Color ColorDarken(Color color, float percent)` * Parameters * `Color color` - The source colour to apply the darken to. * `float percent` - The percent to darken the colour by. * Returns * `Color` - The new colour with the darken applied. The ColorDarken method takes a given colour and darkens it by the given percentage. ### IsEditTime/0 > `public static bool IsEditTime()` * Parameters * _none_ * Returns * `bool` - Returns true if Unity is in the Unity Editor and not in play mode. The IsEditTime method determines if the state of Unity is in the Unity Editor and the scene is not in play mode.