in Azure Cloud Tutorials/Assets/MRTK/SDK/Features/UX/Scripts/Controllers/MixedRealityControllerInfo.cs [148:280]
public void LoadInfo(Transform[] childTransforms, MixedRealityControllerVisualizer motionControllerVisualizer)
{
foreach (Transform child in childTransforms)
{
// Animation bounds are named in two pairs:
// pressed/unpressed and min/max. There is also a value
// transform, which is the transform to modify to
// animate the interactions. We also look for the
// touch transform, in order to spawn the touchpadTouched
// visualizer.
switch (child.name.ToLower())
{
case "pointing_pose":
pointingPose = child.gameObject;
break;
case "pressed":
switch (child.parent.name.ToLower())
{
case "home":
homePressed = child;
break;
case "menu":
menuPressed = child;
break;
case "grasp":
graspPressed = child;
break;
case "select":
selectPressed = child;
break;
case "thumbstick_press":
thumbstickPressed = child;
break;
case "touchpad_press":
touchpadPressed = child;
break;
}
break;
case "unpressed":
switch (child.parent.name.ToLower())
{
case "home":
homeUnpressed = child;
break;
case "menu":
menuUnpressed = child;
break;
case "grasp":
graspUnpressed = child;
break;
case "select":
selectUnpressed = child;
break;
case "thumbstick_press":
thumbstickUnpressed = child;
break;
case "touchpad_press":
touchpadUnpressed = child;
break;
}
break;
case "min":
switch (child.parent.name.ToLower())
{
case "thumbstick_x":
thumbstickXMin = child;
break;
case "thumbstick_y":
thumbstickYMin = child;
break;
case "touchpad_touch_x":
touchpadTouchXMin = child;
break;
case "touchpad_touch_y":
touchpadTouchYMin = child;
break;
}
break;
case "max":
switch (child.parent.name.ToLower())
{
case "thumbstick_x":
thumbstickXMax = child;
break;
case "thumbstick_y":
thumbstickYMax = child;
break;
case "touchpad_touch_x":
touchpadTouchXMax = child;
break;
case "touchpad_touch_y":
touchpadTouchYMax = child;
break;
}
break;
case "value":
switch (child.parent.name.ToLower())
{
case "home":
home = child.gameObject;
break;
case "menu":
menu = child.gameObject;
break;
case "grasp":
grasp = child.gameObject;
break;
case "select":
select = child.gameObject;
break;
case "thumbstick_press":
thumbstickPress = child.gameObject;
break;
case "thumbstick_x":
thumbstickX = child.gameObject;
break;
case "thumbstick_y":
thumbstickY = child.gameObject;
break;
case "touchpad_press":
touchpadPress = child.gameObject;
break;
case "touchpad_touch_x":
touchpadTouchX = child.gameObject;
break;
case "touchpad_touch_y":
touchpadTouchY = child.gameObject;
break;
}
break;
}
}
}