When entering VR on a desktop system with no actual VR headset / controllers attached, simulates a VR controller on the desktop, controllable using mouse & keyboard.
The simulated controller is always an Oculus Quest 2 controller.
The component only has an effect on desktop systems with no actual VR headset / controllers attached. On a VR headset, or a desktop system with a VR headset / controllers attached, it should have no effect.
Contextual prompts appear next to the controller, showing the available controls.
The controller can be moved and rotated using the mouse:
Buttons can be pressed using the keyboard:
Thumbsticks can be controlled as follows:
The Enter key can be used to lock any controller button in the down position. This is particularly useful to lock thumbstick activation, and can also be useful to simulate holding down grip or trigger.
Locked buttons can be released by pressing and releasing the corresponding key.
On mobile devices, including the desktop-vr-controller component will cause a simulated VR controller to appear, but it will not be usable.
None. Currently there are no configurable settings.
There’s lots of settings that could be usefully configurable, and hopefully will be in a future version
<script src="https://cdn.jsdelivr.net/npm/aframe-desktop-vr-controller@0.1.3/dist/desktop-vr-controller.min.js"></script>
Or via npm
npm install aframe-desktop-vr-controller
then in your code…
if (!AFRAME.components['desktop-vr-controller']) require('aframe-desktop-vr-controller')
(the if
test avoids conflicts with other npm packages that may also use aframe-desktop-vr-controller
)
Add the desktop-vr-controller
attribute to any entity that uses oculus-touch-controls
, or a component that wraps this component, such as hand-controls
, laser-controls
, etc.
E.g.
<a-entity id="leftHand"
laser-controls="hand: left"
raycaster="objects: .raycastable"
position="-0.4 1.4 -0.5"
desktop-vr-controller></a-entity>
The controller will auto-configure to the correct hand, based on the hand settings on the oculus-touch-controls
, hand-controls
, laser-controls
, etc. component.
The labels that show the controls point to the physical positions of the buttons on the controllers. When hand-controls
is used, no controller model is displayed, meaning that these indications are not as clear as they are when controller models are displayed.
desktop-vr-controller.html - VR controllers with a classic A-Frame example
object-manipulation.html - VR controllers together with laser-manipulation to move and rotate entities with a laser pointer.