Skip to content

Instantly share code, notes, and snippets.

@lubosz
Created June 26, 2013 15:08
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/5868217 to your computer and use it in GitHub Desktop.
Save lubosz/5868217 to your computer and use it in GitHub Desktop.
Rotate camera to rift input
try:
eu = bge.logic.rotation.to_euler()
except AttributeError:
eu = Euler((0, 0, 0), 'XYZ')
scene = bge.logic.getCurrentScene()
cam = scene.active_camera
fix = Euler((-1.5707963705062866, 0, 0), 'XYZ')
rot = Euler((-eu.z, eu.y, -eu.x), 'XYZ')
rot.rotate(fix)
cam.worldOrientation = rot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment