AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
HoloToolkit.Unity.Utils Class Reference

Miscellaneous utility methods. More...

Static Public Member Functions

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...
 

Detailed Description

Miscellaneous utility methods.

Definition at line 11 of file Utils.cs.

Member Function Documentation

§ 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
aOne end point in the space of endPointSpace
bOther end point in the space of endPointSpace
cylTransformtransform 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
troot transform to start searching from
namename 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
minAlower bound for the original scale
maxAupper bound for the original scale
minBlower bound for new scale
maxBupper bound for new scale
valuethe 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
minAlower bound for the original scale
maxAupper bound for the original scale
minBlower bound for new scale
maxBupper bound for new scale
valuethe 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
stageTransformtransform of higher-level space where 0,1,0 is up
trantransform to be repositioned
offsettranslation offset, Z is forward
yawOffsetyaw offset

Definition at line 60 of file Utils.cs.

§ SetLayerRecursively()

static void HoloToolkit.Unity.Utils.SetLayerRecursively ( GameObject  gameObject,
int  layer 
)
static

Definition at line 14 of file Utils.cs.

§ SetMaterialRecursive()

static void HoloToolkit.Unity.Utils.SetMaterialRecursive ( Transform  t,
Material  mat 
)
static

Change material for every object in hierarchy

Parameters
troot transform to start looking for renderers
matmaterial 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
troot transform to start looking for renderers
matmaterial to set everything to
nameToTestignore GameObjects with this name

Definition at line 123 of file Utils.cs.


The documentation for this class was generated from the following file: