Skip to content

Instantly share code, notes, and snippets.

@lubosz
Created June 26, 2013 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lubosz/5868193 to your computer and use it in GitHub Desktop.
Save lubosz/5868193 to your computer and use it in GitHub Desktop.
get oculus rift input in BGE
from game_engine_rift.rift import PyRift
def poll(rift):
rift.poll()
bge.logic.rotation = Quaternion((rift.rotation[0],
rift.rotation[1],
rift.rotation[2],
rift.rotation[3]))
try:
poll(bge.logic.rift)
except AttributeError:
bge.logic.rift = PyRift()
@dfelinto
Copy link

dfelinto commented Mar 5, 2015

Have you tried:

  bge.logic.rotation = Quaternion((rift.rotation[3],
    rift.rotation[0],
    rift.rotation[1],
    rift.rotation[2]))

This way you create the quaternion as WXYZ, as Blender expects it. I haven't tried, but you probably won't need your 'fix' either, once you use that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment