UCL-VR / ubiq

Other
98 stars 34 forks source link

Desktop Control Scheme #55

Closed sebjf closed 1 month ago

sebjf commented 1 month ago

This PR adds the Desktop Control Scheme for the XRIT, and replaces the Device Simulator as the default keyboard and mouse interface for the XRIT Demo scene.

The scheme is implemented by creating a dedicated RayInteractor that is driven by the Main Camera. It is associated with an XR Controller instance, that isn't actually attached to a controller, but associated with a dedicated set of Action Maps that read typical FPS keyboard and mouse controls. On top of this a Canvas drives a cursor based on the state of the ray interactor, and presents some hints to encourage users to discover the controls. Locomotion is provided by a ContinuousMoveProviderBase subclass, and camera control with the mouse is facilitated by applying the Yaw to the XR Origin and Pitch to the Camera Offset.

This requires notifications for when the headset is added or removed, so the pitch can be reset. Common Notifications are defined in the XRNotification static class, and driven by the appropriate subsystem (for example, for WebXR the notifications are invoked in UbiqWebXRInitOnWebGL.cs

The Control Scheme is implemented as a single Prefab that can be dragged into any XR Interaction Setup hierarchy under the Camera Offset GameObject. References to the XR Origin and other systems are found automatically, so there is no setup. The scheme does not conflict with actual XR devices, so users do not need to turn it on or off.

The Control Scheme is delivered as part of the XRIT Samples - the only thing outside this that this PR touches is for the notifications, so once this PR is in, users can tweak things like the action maps and hints as they like, and we can more easily make changes too.

The Device Simulator has been removed from the XRIT Demo Scene, so that users are no longer required to import it when installing the XRIT.

(The Desktop Control Scheme interoperates with the Device Simulator however, just as it does actual XR devices, if users do want to import it).

bnco-dev commented 1 month ago

Looks brilliant!