richtr / threeVR

An orientation-aware Virtual Reality controller for web browsers built on top of three.js
http://richtr.github.io/threeVR/examples/vr_basic.html
439 stars 97 forks source link

WASD / Controller Input #8

Open IstoraMandiri opened 9 years ago

IstoraMandiri commented 9 years ago

Hi, Loving the VR. Thanks for the library.

Just wanted to ask if you've seen an example of combining this with movement controls, such as using WASD or a Gamepad?

EDIT: it was easier than I thought. Just add something like the following inside requestAnimationFrame

pad = navigator.getGamepads()[0]
if pad
  camera.translateX pad.axes[0]
  camera.translateZ pad.axes[1]
  camera.translateY pad.buttons[0].value*-1 + pad.buttons[1].value
richtr commented 9 years ago

I notice that you have closed this issue.

I do think we should explore adding WASD and Gamepad controls to the library (that can be enabled/disabled by the developer as required).

I'm happy to review pull requests if you are interested in contributing. Also, thank you for providing the basis of your research in to gamepad support in the edit to your post above!

IstoraMandiri commented 9 years ago

Okay cool, I'll re-open the issue - I may eventually get around to sending a PR, but don't let that stop anyone else from going for it!