Miscellaneous utility methods.
More...
|
| static void | SetLayerRecursively (GameObject gameObject, int layer) |
| |
| static float | Map (float minA, float maxA, float minB, float maxB, float value) |
| | This takes a value, whose proportions are defined by minA and maxA, and scales it to a space defined by minB and maxB. For example, 5 in the space of 0 to 10 will map to 50 in the space of 0 to 100. More...
|
| |
| static float | MapAndClamp (float minA, float maxA, float minB, float maxB, float value) |
| | This wrapper performs a map, but sets the results upper and lower limit based on the upper and lower bounds of the new scale. More...
|
| |
| static void | MoveObjectInFrontOfUser (Transform stageTransform, Transform tran, Vector3 offset, float yawOffset) |
| | Position transform along the gaze direction and orient yaw to match, with the specified offset More...
|
| |
| static void | ConnectCylinderBetweenPoints (Transform endPointSpace, Vector3 a, Vector3 b, Transform cylTransform) |
| | Given two points and the transform that they are in, set position, rotation, and scale of a cylinder transform to connect it between the two points More...
|
| |
| static void | SetMaterialRecursive (Transform t, Material mat) |
| | Change material for every object in hierarchy More...
|
| |
| static void | SetMaterialRecursiveForName (Transform t, Material mat, string nameToTest) |
| | Change material for every object in hierarchy which has a name equal to nameToTest. WARNING! See Community Answer This function automatically instantiates the materials and makes them unique to this renderer. It is your responsibility to destroy the materials when the game object is being destroyed. Resources.UnloadUnusedAssets also destroys the materials but it is usually only called when loading a new level. See Unity Documentation More...
|
| |
| static bool | IsInEditor () |
| | helper for detecting if running in editor More...
|
| |
| static Transform | GetChildRecursive (Transform t, string name) |
| | walk hierarchy looking for named transform More...
|
| |
Miscellaneous utility methods.
Definition at line 11 of file Utils.cs.
§ ConnectCylinderBetweenPoints()
| static void HoloToolkit.Unity.Utils.ConnectCylinderBetweenPoints |
( |
Transform |
endPointSpace, |
|
|
Vector3 |
a, |
|
|
Vector3 |
b, |
|
|
Transform |
cylTransform |
|
) |
| |
|
static |
Given two points and the transform that they are in, set position, rotation, and scale of a cylinder transform to connect it between the two points
- Parameters
-
| endPointSpace | |
| a | One end point in the space of endPointSpace |
| b | Other end point in the space of endPointSpace |
| cylTransform | transform for the cylinder primitive to connect |
Definition at line 84 of file Utils.cs.
§ GetChildRecursive()
| static Transform HoloToolkit.Unity.Utils.GetChildRecursive |
( |
Transform |
t, |
|
|
string |
name |
|
) |
| |
|
static |
walk hierarchy looking for named transform
- Parameters
-
| t | root transform to start searching from |
| name | name to look for |
- Returns
- returns found transform or null if none found
Definition at line 157 of file Utils.cs.
§ IsInEditor()
| static bool HoloToolkit.Unity.Utils.IsInEditor |
( |
| ) |
|
|
static |
helper for detecting if running in editor
- Returns
- true if running in editor, false if windows store app
Definition at line 142 of file Utils.cs.
§ Map()
| static float HoloToolkit.Unity.Utils.Map |
( |
float |
minA, |
|
|
float |
maxA, |
|
|
float |
minB, |
|
|
float |
maxB, |
|
|
float |
value |
|
) |
| |
|
static |
This takes a value, whose proportions are defined by minA and maxA, and scales it to a space defined by minB and maxB. For example, 5 in the space of 0 to 10 will map to 50 in the space of 0 to 100.
- Parameters
-
| minA | lower bound for the original scale |
| maxA | upper bound for the original scale |
| minB | lower bound for new scale |
| maxB | upper bound for new scale |
| value | the original scale value to convert to the new scale. |
- Returns
- "value" mapped to the space defined by minB and maxB.
Definition at line 31 of file Utils.cs.
§ MapAndClamp()
| static float HoloToolkit.Unity.Utils.MapAndClamp |
( |
float |
minA, |
|
|
float |
maxA, |
|
|
float |
minB, |
|
|
float |
maxB, |
|
|
float |
value |
|
) |
| |
|
static |
This wrapper performs a map, but sets the results upper and lower limit based on the upper and lower bounds of the new scale.
- Parameters
-
| minA | lower bound for the original scale |
| maxA | upper bound for the original scale |
| minB | lower bound for new scale |
| maxB | upper bound for new scale |
| value | the original scale value to convert to the new scale. |
- Returns
- "value" mapped to the space defined by minB and maxB, constrained by minB and maxB.
Definition at line 48 of file Utils.cs.
§ MoveObjectInFrontOfUser()
| static void HoloToolkit.Unity.Utils.MoveObjectInFrontOfUser |
( |
Transform |
stageTransform, |
|
|
Transform |
tran, |
|
|
Vector3 |
offset, |
|
|
float |
yawOffset |
|
) |
| |
|
static |
Position transform along the gaze direction and orient yaw to match, with the specified offset
- Parameters
-
| stageTransform | transform of higher-level space where 0,1,0 is up |
| tran | transform to be repositioned |
| offset | translation offset, Z is forward |
| yawOffset | yaw offset |
Definition at line 60 of file Utils.cs.
§ SetLayerRecursively()
| static void HoloToolkit.Unity.Utils.SetLayerRecursively |
( |
GameObject |
gameObject, |
|
|
int |
layer |
|
) |
| |
|
static |
§ SetMaterialRecursive()
| static void HoloToolkit.Unity.Utils.SetMaterialRecursive |
( |
Transform |
t, |
|
|
Material |
mat |
|
) |
| |
|
static |
Change material for every object in hierarchy
- Parameters
-
| t | root transform to start looking for renderers |
| mat | material to set everything to |
Definition at line 99 of file Utils.cs.
§ SetMaterialRecursiveForName()
| static void HoloToolkit.Unity.Utils.SetMaterialRecursiveForName |
( |
Transform |
t, |
|
|
Material |
mat, |
|
|
string |
nameToTest |
|
) |
| |
|
static |
Change material for every object in hierarchy which has a name equal to nameToTest. WARNING! See Community Answer This function automatically instantiates the materials and makes them unique to this renderer. It is your responsibility to destroy the materials when the game object is being destroyed. Resources.UnloadUnusedAssets also destroys the materials but it is usually only called when loading a new level. See Unity Documentation
- Parameters
-
| t | root transform to start looking for renderers |
| mat | material to set everything to |
| nameToTest | ignore GameObjects with this name |
Definition at line 123 of file Utils.cs.
The documentation for this class was generated from the following file:
- Assets/HoloToolkit/Utilities/Scripts/Utils.cs