Guides
Guides

VRTK_OutlineObjectCopyHighlighter

extends VRTK_BaseHighlighter

Overview

Creates a mesh copy and applies an outline shader which is toggled on and off when highlighting the object.

A valid mesh must be found or provided for the clone mesh to be created.

Script Usage:

  • Place the VRTK_OutlineObjectCopyHighlighter script on either:
    • The GameObject of the Interactable Object to highlight.
    • Any other scene GameObject and then link that GameObject to the Interactable Objects Object Highlighter parameter to denote use of the highlighter.
  • Ensure the Active parameter is checked.

Inspector Parameters

  • Thickness: The thickness of the outline effect
  • Custom Outline Models: The GameObjects to use as the model to outline. If one isn't provided then the first GameObject with a valid Renderer in the current GameObject hierarchy will be used.
  • Custom Outline Model Paths: A path to a GameObject to find at runtime, if the GameObject doesn't exist at edit time.
  • Enable Submesh Highlight: If the mesh has multiple sub-meshes to highlight then this should be checked, otherwise only the first mesh will be highlighted.

Class Methods

Initialise/3

public override void Initialise(Color? color = null, GameObject affectObject = null, Dictionary<string, object> options = null)

  • Parameters
    • Color? color - Not used.
    • GameObject affectObject - An optional GameObject to specify which object to apply the highlighting to.
    • Dictionary<string, object> options - A dictionary array containing the highlighter options:\r <'thickness', float> - Same as thickness inspector parameter.\r <'customOutlineModels', GameObject[]> - Same as customOutlineModels inspector parameter.\r * <'customOutlineModelPaths', string[]> - Same as customOutlineModelPaths inspector parameter.
  • Returns
    • none

The Initialise method sets up the highlighter for use.

ResetHighlighter/0

public override void ResetHighlighter()

  • Parameters
    • none
  • Returns
    • none

The ResetHighlighter method creates the additional model to use as the outline highlighted object.

Highlight/2

public override void Highlight(Color? color, float duration = 0f)

  • Parameters
    • Color? color - The colour to outline with.
    • float duration - Not used.
  • Returns
    • none

The Highlight method initiates the outline object to be enabled and display the outline colour.

Unhighlight/2

public override void Unhighlight(Color? color = null, float duration = 0f)

  • Parameters
    • Color? color - Not used.
    • float duration - Not used.
  • Returns
    • none

The Unhighlight method hides the outline object and removes the outline colour.

Example

VRTK/Examples/005_Controller_BasicObjectGrabbing demonstrates the outline highlighting on the green sphere when the controller touches it.

VRTK/Examples/035_Controller_OpacityAndHighlighting demonstrates the outline highlighting if the left controller collides with the green box.