DesktopControls

csharp
public sealed class DesktopControls : MonoBehaviour

Namespace NodeWorld.SDK.Client.XR.

Keyboard and mouse controls without a headset (no-VR mode of the client, and the Play mode of a world), with the keys of VRChat desktop (docs.vrchat.com/docs/keyboard-and-mouse). Keys are read by position (US layout), so ZQSD moves on an AZERTY keyboard: - WASD move, mouse looks, Space jumps, Shift sprints, C crouches, Z goes prone, , and . turn; - left click interacts or picks up (and uses a held pickup), right click drops it, right click with F held throws it; while holding: mouse wheel moves it forward and back, I/K J/L U/O and the middle button with the mouse rotate it; - right click held shows the mouse to point at things, and so does Tab: a short press toggles the mouse, holding the key keeps it while held (DesktopPointerKey); V mutes the mic, Shift+R asks to respawn, P takes the camera out or puts it away (DesktopShortcuts). Escape opens the menu through the menu action of the rig (XRI Left/Menu is also bound to Escape). Every key is read through the TypingGate: while a text field is typed in, the keys only type. The left button always clicks the UI (a click outside the field ends the typing), but a press that starts while typing neither picks up nor uses anything in the world until it is released. The application's UI is on the screen (Screen Space Overlay canvases, clicked by the mouse through the UI input module): while its menu is open (IDesktopControlsHost.MenuOpen) the world gets no click, no scroll and no hover, and a press that starts on a screen canvas (a notification) is for that canvas only. With the camera out (IDesktopControlsHost.CameraOut), a left click aimed with the crosshair only takes the photo. The XR rig stays the one of VR: this drives its camera, its hands and the right Near-Far interactor instead of tracked devices, so locomotion, grabs, portals and menus work as in VR. The application around it (IDesktopControlsHost) tells whether the player is in a world and the menu open, and mutes the mic. Runs before the XRI locomotion providers (-210), so the move and jump providers read this frame's keys (the jump provider only re-arms on the frame it sees the key released), and before the UI input module and the XR Interaction Manager.

Methods

Create

csharp
public static DesktopControls Create(VRPlayerController player, GameObject crosshairPrefab, INWLogger logger)

Switches the XR rig of the player to keyboard and mouse.

Bind

csharp
public void Bind(IDesktopControlsHost host)

The application around the player, once it exists; until then the mouse points (login, loading).