Created
June 26, 2013 15:08
-
-
Save lubosz/5868217 to your computer and use it in GitHub Desktop.
Rotate camera to rift input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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