Guides

VRTK_ControllerHighlighter

Overview

Enables highlighting of controller elements.

Optional Components:

  • VRTK_BaseHighlighter - The highlighter to use when highligting the controller. If one is not already injected in the Controller Highlighter parameter then the component on the same GameObject will be used.

Script Usage:

  • Place the VRTK_ControllerHighlighter script on either:
    • The controller script alias GameObject of the controller to affect (e.g. Right Controller Script Alias).
    • Any other scene GameObject and provide the controller script alias GameObject to the Controller Alias parameter of this script.
  • The Model Element Paths will be auto populated at runtime based on the SDK Setup Model Alias being used (except if a custom Model Alias for the SDK Setup is provided).
  • The Highlighter used by the Controller Highlighter will be selected in the following order:
    • The provided Base Highlighter in the Controller Highlighter parameter.
    • If the above is not provided, then the first active Base Highlighter found on the actual controller GameObject will be used.
    • If the above is not found, then a Material Color Swap Highlighter will be created on the actual controller GameObject at runtime.

Inspector Parameters

  • Transition Duration: The amount of time to take to transition to the set highlight colour.
  • Highlight Controller: The colour to set the entire controller highlight colour to.
  • Highlight Body: The colour to set the body highlight colour to.
  • Highlight Trigger: The colour to set the trigger highlight colour to.
  • Highlight Grip: The colour to set the grip highlight colour to.
  • Highlight Touchpad: The colour to set the touchpad highlight colour to.
  • Highlight Touchpad Two: The colour to set the touchpad two highlight colour to.
  • Highlight Button One: The colour to set the button one highlight colour to.
  • Highlight Button Two: The colour to set the button two highlight colour to.
  • Highlight System Menu: The colour to set the system menu highlight colour to.
  • Highlight Start Menu: The colour to set the start menu highlight colour to.
  • Model Element Paths: A collection of strings that determine the path to the controller model sub elements for identifying the model parts at runtime. If the paths are left empty they will default to the model element paths of the selected SDK Bridge.
  • Element Highlighter Overrides: A collection of highlighter overrides for each controller model sub element. If no highlighter override is given then highlighter on the Controller game object is used.
  • Controller Alias: An optional GameObject to specify which controller to apply the script methods to. If this is left blank then this script is required to be placed on a controller script alias GameObject and it will use the Actual Controller GameObject linked to the controller script alias.
  • Model Container: An optional GameObject to specifiy where the controller models are. If this is left blank then the controller Model Alias object will be used.
  • Controller Highlighter: An optional Highlighter to use when highlighting the controller element. If this is left blank, then the first active highlighter on the same GameObject will be used, if one isn't found then a Material Color Swap Highlighter will be created at runtime.

Class Methods

ConfigureControllerPaths/0

public virtual void ConfigureControllerPaths()

  • Parameters
    • none
  • Returns
    • none

The ConfigureControllerPaths method is used to set up the model element paths.

PopulateHighlighters/0

public virtual void PopulateHighlighters()

  • Parameters
    • none
  • Returns
    • none

The PopulateHighlighters method sets up the highlighters on the controller model.

HighlightController/2

public virtual void HighlightController(Color color, float fadeDuration = 0f)

  • Parameters
    • Color color - The Color to highlight the controller to.
    • float fadeDuration - The duration in seconds to fade from the initial color to the target color.
  • Returns
    • none

The HighlightController method attempts to highlight all sub models of the controller.

UnhighlightController/0

public virtual void UnhighlightController()

  • Parameters
    • none
  • Returns
    • none

The UnhighlightController method attempts to remove the highlight from all sub models of the controller.

HighlightElement/3

public virtual void HighlightElement(SDK_BaseController.ControllerElements elementType, Color color, float fadeDuration = 0f)

  • Parameters
    • SDK_BaseController.ControllerElements elementType - The element type on the controller.
    • Color color - The Color to highlight the controller element to.
    • float fadeDuration - The duration in seconds to fade from the initial color to the target color.
  • Returns
    • none

The HighlightElement method attempts to highlight a specific controller element.

UnhighlightElement/1

public virtual void UnhighlightElement(SDK_BaseController.ControllerElements elementType)

  • Parameters
    • SDK_BaseController.ControllerElements elementType - The element type on the controller.
  • Returns
    • none

The UnhighlightElement method attempts to remove the highlight from the specific controller element.

Example

VRTK/Examples/035_Controller_OpacityAndHighlighting demonstrates the ability to change the opacity of a controller model and to highlight specific elements of a controller such as the buttons or even the entire controller model.