VRTK_InteractObjectHighlighter
extends VRTK_InteractableListener
Overview
Enable highlighting of an Interactable Object base on interaction type.
Required Components:
VRTK_InteractableObject
- The Interactable Object component to detect interactions on. This must be applied on the same GameObject as this script if one is not provided via theObject To Monitor
parameter.
Optional Components:
VRTK_BaseHighlighter
- The highlighter to use when highligting the Object. If one is not already injected in theObject Highlighter
parameter then the component on the same GameObject will be used.
Script Usage:
- Place the
VRTK_InteractObjectHighlighter
script on either:- The GameObject of the Interactable Object to detect interactions on.
- Any other scene GameObject and provide a valid
VRTK_InteractableObject
component to theObject To Affect
parameter of this script.
Inspector Parameters
- Near Touch Highlight: The colour to highlight the object on the near touch interaction.
- Touch Highlight: The colour to highlight the object on the touch interaction.
- Grab Highlight: The colour to highlight the object on the grab interaction.
- Use Highlight: The colour to highlight the object on the use interaction.
- Object To Highlight: The GameObject to highlight.
- Object Highlighter: An optional Highlighter to use when highlighting the specified Object. 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 Events
InteractObjectHighlighterHighlighted
- Emitted when the object is highlightedInteractObjectHighlighterUnhighlighted
- Emitted when the object is unhighlighted
Unity Events
Adding the VRTK_InteractObjectHighlighter_UnityEvents
component to VRTK_InteractObjectHighlighter
object allows access to UnityEvents
that will react identically to the Class Events.
- All C# delegate events are mapped to a Unity Event with the
On
prefix. e.g.MyEvent
->OnMyEvent
.
Event Payload
VRTK_InteractableObject.InteractionType interactionType
- The type of interaction occuring on the object to monitor.Color highlightColor
- The colour being provided to highlight the affected object with.GameObject affectingObject
- The GameObject is initiating the highlight via an interaction.VRTK_InteractableObject objectToMonitor
- The Interactable Object that is being interacted with.GameObject affectedObject
- The GameObject that is being highlighted.
Class Methods
ResetHighlighter/0
public virtual void ResetHighlighter()
- Parameters
- none
- Returns
- none
The ResetHighlighter method is used to reset the currently attached highlighter.
Highlight/1
public virtual void Highlight(Color highlightColor)
- Parameters
Color highlightColor
- The colour to apply to the highlighter.
- Returns
- none
The Highlight method turns on the highlighter with the given Color.
Unhighlight/0
public virtual void Unhighlight()
- Parameters
- none
- Returns
- none
The Unhighlight method turns off the highlighter.
GetCurrentHighlightColor/0
public virtual Color GetCurrentHighlightColor()
- Parameters
- none
- Returns
Color
- The Color that the Interactable Object is being highlighted to.
The GetCurrentHighlightColor returns the colour that the Interactable Object is currently being highlighted to.
Updated less than a minute ago