WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-12-2016, 08:25 AM
bbb bbb is offline
Member
 
Join Date: Nov 2015
Posts: 46
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
Reply With Quote
  #2  
Old 01-12-2016, 08:34 AM
bbb bbb is offline
Member
 
Join Date: Nov 2015
Posts: 46
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.
Reply With Quote
  #3  
Old 01-12-2016, 01:14 PM
haohaoxuexi1 haohaoxuexi1 is offline
Member
 
Join Date: Sep 2015
Posts: 81
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
Reply With Quote
  #4  
Old 01-13-2016, 06:52 AM
bbb bbb is offline
Member
 
Join Date: Nov 2015
Posts: 46
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.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:54 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC