npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aframe-desktop-vr-controller

v0.1.3

Published

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

Downloads

10

Readme

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.

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.

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.

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/[email protected]/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)

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.

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