Giter Club home page Giter Club logo

6dof-gearvrcontroller.js's Introduction

Under Attribution-NonCommercial-ShareAlike 4.0 International License
Cwig's under MIT License
Jsyang's under GPL-3.0 License

6DOF GearVR Controller Tracking

An easy way to use GearVR for more complicated use cases such as VR game that need 6DOF tracking.

How it works

  • Camera tracks colors for position tracking.
  • Gear VR controllers already have Built-in 3DOF tracking.

What you need

Software

Client Side

import { ClientTracking } from "./dist/GearVRController.js";

var tracking = new ClientTracking(codePreviewElement, threejsHandObject);

Server Side

import { ServerTracking } from "./dist/GearVRController.js";

var tracking = new ServerTracking(clientCode);

NodeJS Socket Server

const { Server } = require("socket.io");
const { createServer } = require('http');

const server = createServer(app);
const io = new Server(server);

io.on('connection', (socket) => {
    console.log('User connected ' + socket.id);

    socket.on("controllerDataOut", (id, data) => {
        socket.to(id).emit("controllerDataIn", data);
    });
    
    socket.on('disconnect', () => {
        console.log('User disconnected');
    });
});

server.listen(8080, () => {
    console.log(`Web app listening on port ${8080}`);
});

Hardware

Controller modifications

Final Controllers

Steps to reproduce

Prepare lights

  • Get 2 shuttlecocks and make sure that one is red and one is green.
  • Cut the feathers off of the shuttlecocks.
  • Remove the blue tape off both of the shuttlecocks.

Tape the lights

  • Cut off the tape into 3 bits width ways so you have 3 smaller bits of tape.
  • Tape one on one side and the other on the oppersite side of the light.
  • Finish by Wrapping the 3rd bit around the whole bottom like the blue tape was.
  • Attach both loose ends of tape to both sides of the controller.
  • Fill in the gaps with more tape making sure that none of it sticks to the controller so it is easy to turn on and off the light.
  • Repeat for the second controller.
  • You should now have 2 controllers that look simular to mine.

Final steps

  • Plug in your webcam.
  • Open the webpage in a chromium-based browser.
  • Your done!

Credits

  • CrazyH (Made this repo, added positional tracking and support for multiple controllers)
  • Huge thanks to Cwig for gearvr exploration which created the foundation for the Gear VR controller tracking.
  • Thanks to jsyang as well for creating a library that Cwig improved on.

6dof-gearvrcontroller.js's People

Contributors

crazyh2 avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.