XRShared
The XRShared addon provides the base component to create a XR experience compatible with Fusion.
Architecture and detailed explanation
The logic to build the same components than the one provided in this addon is described in the VR Shared sample, with in-depth explanations of the choices.
Features
Rig logic: hardware and network rig
See Rigs, in VRShared samples for concepts
The following script are used to collect the position of the various rig parts (headset, left hand, right hand, rig root):
HardwareRig
HardwareHeadset
HardwareHand
Then, their corresponding network script collect for the local user the position/rotation data provided by the hardware script, and synchronize them to all players:
NetworkRig
NetworkHeadset
NetworkHand
Basic hand state (index, thumb and grabbing position) are also synchronized in the hand script.
Grabbing
Basic grabbing functionality is demonstrated in the addon. Two approaches are available.
Network hand-based grabbing
See Grabbing in the VR Shared sampple, for the concept of a fully network-based grabbing
In this approach, the hovering detection over a grabbable is done with the network hand's colliders.
The grabbable object must have a NetworkHandColliderGrabbable
component, and the NetworkHand
a NetworkHandColliderGrabber
component.
Hardware hand-based grabbing
See the dedicated Local rig grabbing page, for an approach where the grabbing is initiated by the hardware rig
In this approach, the hovering is detected on the hardware hand's colliders, and can also be used for non-networked objects.
For non-networked grabbing, the grabbable object must have a Grabbable
, and the hardware hand a GrabberComponent
For networked grabbing, in addition to those previous components, the grabbable object must also have a NetworkGrabbable
component, and the NetworkHand
a NetworkGrabber
component.
Locomotion
See Teleport & locomotion for details
The addon demonstrates basic locomotion, with simple teleportation.
The RayBeamer
class displays a line renderer-based beam, and upon release, the RigLocomotion
place next to the HardwareRig
triggers the rig movement.
The RigLocomotion
scripts also handles snap rotation.
Demo
A demo scene can be found in Assets\Photon\FusionAddons\XRShared\Demo\Scenes\
folder.
Download
This addon latest version is included into the Industries addon project
It is also included into the free XR addon project
Supported topologies
- shared mode
Changelog
- Version 2.0.6:
- Add basic feedback component to XRShared
- Add SharedDesign folder with common materials and UI elements
- Add cooldown to PrefabSpawner
- Add IContactHandler interface
- Prevent Toucher to trigger callbacks on remote user when used on a NetworkObject (by default, only the state authority of the toucher parent can trigger a toucher)
- Ungrab when loosing the state authority on a NetworkGrabbable
- Version 2.0.5:
- Fix XRControllerInputDevice position when using Oculus XR plug-in
- Allow to prevent temporarily snap rotation in RigLocomotion
- Add basic UserSpawner script
- Add HideRenderers script
- Version 2.0.4:
- Prevent disabled Grabber components from grabbing
- Add reference transforms to the hardware hand: it will be moved at the first active (in hierarchy) transform listed
- Add WeaverHelper (to check/edit assembliestoWeave in config) and improvement to PackagePresenceCheck
- Version 2.0.3:
- Add IColorProvider and IFeedbackHandler interfaces
- Add GrabbableColorSelection
- Version 2.0.2:
- Ensure compatibility with Unity 2021.x (box colliders, edited in 2022.x, in prefab had an improper size when opened in 2021.x)
- Add layer utils to simplify automatic configuration of layers between projects
- Version 2.0.1: Add VolumeCamera handling in HideForLocalUser if Polyspatial is installed
- Version 2.0.0: First release