-
Notifications
You must be signed in to change notification settings - Fork 1
Buttons
Buttons are physical objects in the scene that the player can interact with via the little sphere floating above the right controller. The player can hover over buttons by moving the right controller so the sphere collides with the button. On hover, the button, selector sphere, and controller change color and the right controller triggers haptic feedback. While hovering, the player can press the button by pressing the trigger on the right controller.
To interact with a new button, either drag in a button prefab into your scene from Assets -> Prefabs -> Dashboard -> Button
or attach Button.cs
to the gameobject that you want to be a button.
This script reveals multiple different parameters in the inspector:
Button Text: What you want the button label to be.
Right Controller: A reference to the RightHandAnchor
to trigger haptics and color changes.
Default Button Color: The color that you want the button to be.
Hover Button Color: The color you want the button to be when you are hovering over it with your right controller.
Hover/Selection Haptic Frequency/Amplitude/Duration: Refers to the haptic parameters triggered on the right controller.
Button.cs
evokes two events:
OnClick: This event in invoked when the selector sphere on the right hand is hovering over a button and the trigger button is pressed.
onButtonEnter: This event is invoked when the selector sphere on the right hand is hovering over a button.