Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aframe-desktop-vr-controller

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aframe-desktop-vr-controller

Simulates a VR controller on the desktop, controllable using mouse & keyboard.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by300%
Maintainers
1
Weekly downloads
 
Created
Source

desktop-vr-controller

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.

Controls

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.

image-20220802185450073

The controller can be moved and rotated using the mouse:

  • left button + drag to move left/right and up/down
  • right button + drag to pitch and yaw
  • roll mouse wheel while holding left or right button to move in / out
  • middle mouse button + drag to roll

Buttons can be pressed using the keyboard:

  • Left shift / left control for left grip and trigger
  • Right shift / right control for right grip and trigger
  • X & Y for X & Y buttons (on left controller)
  • V & B for A & B buttons (on right controller) - not e that V is used instead of A to avoid overlap with WASD

Thumbsticks can be controlled as follows:

  • Hold down 1 or 2 to engage thumbstick for the left or right controller
  • A thumbstick controller will appear on-screen at the current mouse location. Move the mouse to move the thumbstick.
  • Left or right click can be used to click the thumbstick.
image-20220802185543518

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.

image-20220802185741939

On mobile devices, including the desktop-vr-controller component will cause a simulated VR controller to appear, but it will not be usable.

Schema

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

Installation

<script src="https://cdn.jsdelivr.net/npm/aframe-mouse-manipulation@0.1.0/dist/mouse-manipulation.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)

Usage

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.

image-20220802190100076

Examples

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.

Code

desktop-vr-controller

Keywords

FAQs

Package last updated on 20 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc