All Projects → stewdio → Three.vrcontroller

stewdio / Three.vrcontroller

Licence: mit
Support hand controllers for Oculus, Vive, Windows Mixed Reality, Daydream, GearVR, and more by adding VRController to your existing Three.js-based WebVR project.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Three.vrcontroller

Remixvr
RemixVR is a tool for collaboratively building customisable VR experiences.
Stars: ✭ 129 (-39.44%)
Mutual labels:  threejs, oculus, webvr, webxr
Ideaspace
😎 Create interactive 3D and VR web experiences for desktop, mobile & VR devices
Stars: ✭ 344 (+61.5%)
Mutual labels:  threejs, oculus, webvr, webxr
spacesvr
A standardized reality for the future of the 3D Web.
Stars: ✭ 135 (-36.62%)
Mutual labels:  threejs, webvr, webxr
Handy.js
Handy makes defining and recognizing custom hand shapes in WebXR a snap!
Stars: ✭ 76 (-64.32%)
Mutual labels:  threejs, oculus, webxr
Thehallaframe
WebVR demo that displays art
Stars: ✭ 120 (-43.66%)
Mutual labels:  threejs, oculus, webvr
Three Mesh Bvh
A BVH implementation to speed up raycasting against three.js meshes.
Stars: ✭ 302 (+41.78%)
Mutual labels:  threejs, webvr, webxr
Webxr Handtracking
👐 WebXR hand tracking examples
Stars: ✭ 116 (-45.54%)
Mutual labels:  threejs, oculus, webxr
Moonrider
🌕🏄🏿 Surf the musical road among the stars. Side project built by two people in a few months to demonstrate WebXR.
Stars: ✭ 292 (+37.09%)
Mutual labels:  threejs, webvr, webxr
Aframe
🅰️ web framework for building virtual reality experiences.
Stars: ✭ 13,428 (+6204.23%)
Mutual labels:  threejs, oculus, webvr
Aframe Vimeo Component
Stream Vimeo videos into WebVR.
Stars: ✭ 62 (-70.89%)
Mutual labels:  threejs, oculus, webvr
Awesome Aframe
[DISCONTINUED] Collection of awesome resources for the A-Frame WebVR framework.
Stars: ✭ 1,310 (+515.02%)
Mutual labels:  threejs, webvr
Nunustudio
Web powered cross-platform 3D, WebXR game engine.
Stars: ✭ 1,302 (+511.27%)
Mutual labels:  webvr, webxr
Webxr Input Profiles
WebXR Gamepad assets, source library, and schema
Stars: ✭ 72 (-66.2%)
Mutual labels:  gamepad, webxr
Babylon.js
Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework.
Stars: ✭ 15,479 (+7167.14%)
Mutual labels:  webvr, webxr
Webvr Polyfill
Use WebVR today, without requiring a special browser build.
Stars: ✭ 1,343 (+530.52%)
Mutual labels:  webvr, webxr
Aframe Effects
A VR Ready Post processing framework for Three.js and/or A-Frame
Stars: ✭ 176 (-17.37%)
Mutual labels:  threejs, webvr
A Mmd
A-Frame MMD component
Stars: ✭ 74 (-65.26%)
Mutual labels:  threejs, webvr
Konterball
Konterball is a single or 2-player virtual reality game, built for the web as a Google VR Chrome Experiment.
Stars: ✭ 112 (-47.42%)
Mutual labels:  threejs, webvr
Forgejs
ForgeJS is a javascript framework that unleashes immersive WebVR experiences.
Stars: ✭ 207 (-2.82%)
Mutual labels:  threejs, webvr
Tweetscape
A WebVR experience displaying tweets in real-time along a 3D timeline
Stars: ✭ 132 (-38.03%)
Mutual labels:  threejs, webvr

THREE.VRController

THREE.VRController

Support hand controllers for Oculus, Vive, Windows Mixed Reality, Daydream, GearVR, and more by adding VRController to your existing Three.js-based WebVR project. VRController wraps the Web Gamepad API, handles gamepad browser quirks, emits a controller instance (an extended THREE.Object3D) upon gamepad discovery, handles controller updates for position and orientation—including 3DOF rigs via the OrientationArmModel—and watches for updates on axes and button states—emitting corresponding events on the controller instance. (Pretty great, right?!)

VRController includes explicit support for Oculus Rift + Touch, HTC Vive, Windows Mixed Reality motion controllers, Google Daydream, and has implicit support for Samsung GearVR and similar devices. Is your company developing new hand controllers? Send them my way and I’ll add support for it. 😉

VRController is compatible with Three.js r87 which is the first version to use the new renderer.vr object and was originally submitted to Three.js as pull request #10991 on Saturday, 11 March 2017. Note: that pull request is no longer maintained.

Requirements

  1. Virtual Reality rig with 3DOF or 6DOF controllers such as the Oculus Rift + Touch, HTC Vive, a Windows Mixed Reality rig, Google Daydream, Samsung GearVR, or similar devices.
  2. WebVR-capable browser. For the latest list of browsers that support WebVR—as well as download and setup instructions—see WebVR Rocks.
  3. Working knowledge of Three.js.

Try it now!

Already on a VR rig with a WebVR-capable browser? Just point your browser to https://stewdio.github.io/THREE.VRController/ to experience this code in action.

Do it yourself

  1. Add our VRController.js file to your existing Three.js project and use our index.html example file as your guide for the following steps.
  2. Add a THREE.VRController.update() function call to your animation loop.
  3. Add a listener for the "vr controller connected" global event. This is how you will receive the controller object instance—which is an extended THREE.Object3D. This means you can add it to your scene, attach meshes to it, and so on.
  4. When you receive the controller object instance you must give it some additional information depending on the type of controller. For 6DOF (room scale) rigs you must provide a standing matrix, easily obtained from your WebGLRenderer instance in Three.js r87 and above. This will look similar to: controller.standingMatrix = renderer.vr.getStandingMatrix(). For 3DOF (seated) rigs you must provide a reference to the camera so the controller can use the headset’s live position and orientation to guess where it ought to be: controller.head = camera. There’s no penalty for providing the controller instance with both standingMatrix and head properties as we do in the example.
  5. Explore the available touch, press, and trackpad events by assigning THREE.VRController.verbosity = 1. You’ll now see a flood of verbose comments in the JavaScript console as you interact with your controller. To access controllers directly from the console explore the THREE.VRController.controllers object. To get a snapshot of all controller data try THREE.VRController.inspect().

Run locally

For security reasons you can’t run a WebVR experience by just dragging the index file onto a browser tab. You have to run an actual server. The easiest way to do this on your own desktop machine is to start a simple Python server. Open up a command line prompt, navigate to wherever you’ve stored this code package, then type the following command depending on the version of Python you have installed.

Python 2: python -m SimpleHTTPServer 8000
Python 3: py -m http.server 8000

In your browser you can now navigate to http://localhost:8000/ to see the demo running locally. You can shutdown the local server by returning to the command line and hitting Control + C.

Notes on Chromium’s Gamepad API

If you’re building WebVR experiences and targeting the WebVR build of Chromium you may want to read my Medium post about its quirky behavior and how VRController compensates for it: WebVR controllers and Chromium’s Gamepad API.

Space Rocks!

Space Rocks

Looking for a more complex, fleshed out example of VRController in action? Play Space Rocks now at https://spacerocks.moar.io You can read more about it on Medium or check out the code repository. Look for VRController-related bits in /scripts/player.js.

And for the full technical breakdown, including multi-channel haptic feedback, button handling, and attaching visuals to controllers, see Space Rocks—WebXR tech deep dive.

Space Rocks technical deep dive

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].