#1
|
|||
|
|||
getPosition and getEuler using oculus with xbox or keyboard
Hello,
I'm trying to find a function like viz.MainView.getPosition and viz.MainView.getEuler for a combination of oculus DK2 with keyboard or xbox. For example, if i have a link between oculus and keyboard like this: # Key commands KEYS = { 'forward' : viz.KEY_UP ,'back' : viz.KEY_DOWN ,'left' : viz.KEY_LEFT ,'right' : viz.KEY_RIGHT ,'reset' : 'r' ,'camera' : 'c' ,'help' : ' ' } # Setup navigation node and link to main view navigationNode = viz.addGroup() viewLink = viz.link(navigationNode, viz.MainView) viewLink.preMultLinkable(hmd.getSensor()) # Setup arrow key navigation MOVE_SPEED = 2.0 def UpdateView(): yaw,pitch,roll = viewLink.getEuler() m = viz.Matrix.euler(yaw,0,0) dm = viz.getFrameElapsed() * MOVE_SPEED if viz.key.isDown(KEYS['forward']): m.preTrans([0,0,dm]) if viz.key.isDown(KEYS['back']): m.preTrans([0,0,-dm]) if viz.key.isDown(KEYS['left']): m.preTrans([-dm,0,0]) if viz.key.isDown(KEYS['right']): m.preTrans([dm,0,0]) navigationNode.setPosition(m.getPosition(), viz.REL_PARENT) vizact.ontimer(0,UpdateView) how do i get position and orientation? Thanks |
#2
|
|||
|
|||
I mean how do i get x,y,z position and orientation? I need to write the changes in position and orientation every 0.1 ms into a file for analaysis.
|
#3
|
|||
|
|||
you can define a function to get the position of the sensor
and use "ontimer" to run the function every frame the command should be getPosition and getEuler hope it can help you |
#4
|
|||
|
|||
Thanks for your answer, i thought about it myself but the problem with that as far
as i understand is it only give me position and orientation from the HMD sensor but not from keyboard/xbox movememt or HMD&keyboard/xbox movement togethere. |
|
|