Touch & Hover
This addon provides several classes to manage touch and hover actions on objects and UI elements. Those events can be triggered offline, and are not synched over the network: if it is required, the sync has to be done in the components listening to the various callbacks.
Touch
Toucher
The Toucher
class detects Touchable
components (object implementing the ITouchable
interface) in contact.
It must be place under an HardwareHand
to manage haptic feedback properly, typically on both hands of the hardware rig.
This class uses the Unity OnTrigger
events to inform Touchable
objects with methods :
- OnToucherContactStart()
- OnToucherStay()
- OnToucherContactEnd()
BeamToucher
BeamToucher
simulates a touch when the player uses the beam and presses the trigger button.
It is used to interact with Touchable
objects or UI elements (button & sliders).
It must be place under an HardwareHand
, typically on both hands of the hardware & desktop rigs.
Please note that a RayBeamer
is required on the game object as the BeamToucher
class is listening to the RayBeamer
callbacks.
The Touchable
object type can be filtered thanks to the TouchableComponents
enum.
Touchable
The Touchable
class allows to touch an object with a Toucher
or a BeamToucher
, and trigger onTouch
& onUnTouch
events.
It should be associated with a trigger Collider
in order to trigger Unity OnTrigger
events.
The isToggleButton
boolean is used to specify whether this is a toggle-type button.
This class can change the object material when it is touched and uses the Feedback
addon to play audio and/or haptic feedback.
UI
TouchableCanvas
TouchableCanvas
searchs for UI element in game object children in order to add touch interaction capability.
This avoid to edit each UI manually.
To do so, a prefab must be provided for UI elements concerned (button, slider or inputfield).
UITouchButton
UITouchButton
is used to add VR 3D button interaction on a UI button.
A BoxCollider
is required on the game object. The size of the BoxCollider
is changed to the size of the UI button to generate a corresponding 3D button collider.
When the player touches the 3D button box collider, the OnTouch
event of the Touchable
class is forwarded to the UI button.
TouchableSlider
In the same way as the UITouchButton
for UI buttons, TouchableSlider
adds support to VR touch interaction to a UI slider.
It should be stored as a child of a slider to give touch capabilities to it.
This class uses the Feedback
addon to play audio and haptic feedback.
Hover
BeamHoverer
BeamHoverer
simulates an hover when the player activate the beam and hover an object.
It is used to interact with BeamHoverable
objects.
It must be place under an HardwareHand
object, typically on both hands of the hardware & desktop rigs.
Please note that a RayBeamer
is required on the game object as the BeamHoverer
class is listening to the RayBeamer
callbacks.
BeamHoverable
The BeamHoverable
class allows to hover an object with a BeamHoverer
, and trigger onBeamHoverStart
, onBeamRelease
& onBeamHoverEnd
events.
It should be associated with a trigger Collider
in order to trigger Unity OnTrigger
events.
This class can change the object material when it is hovered and uses the Feedback
addon to play audio and/or haptic feedback.
It is also possible to choose an object to activate/deactivate depending on the hover state.
Dependencies
- Feedback addon
Demo
A demo scene can be found in the Assets\Photon\FusionAddons\Touchable\Demo\Scenes\
folder.
Download
This addon latest version is included into the Industries addon project
Supported topologies
- shared mode
Changelog
- Version 2.1.2: Small fix in Touchable to manage object deletion
- Version 2.1.1: Remove dependency in Demo prefab
- Version 2.1.0: Move toucher to XRShared add-on
- Version 2.0.0: First release