|
|
Thread Tools | Rate Thread | Display Modes |
#1
|
|||
|
|||
preEuler not working? or how to teleport subject multiple times
hello everybody i'm a psychology and computerscience student from germany.
so currently for our research project, we are implementing a basic trial in vizard. basiclly whats happening is the following: 1-subject gets set into a specific spot with specific direction 2-subjects orientation gets set into a specific direction 3-subject needs to do something 4- 2 and 3 until loop finishes 5 - 1 till 4 until loop is finished for the experiment we use the PPT and a oculus rift. so we use a code that kinda looks simplified like this: Code:
#first block is linking the HMD and PPT hmd = oculus.Rift(window=viz.MainWindow, autoDetectMonitor=True) sensor = hmd.getSensor() vrpn = viz.add('vrpn7.dle') tracker = vrpn.addTracker('PPT0@WV') link_headtracker = viz.mergeLinkable(tracker, sensor) linkAll = viz.link(link_headtracker, viz.MainView) #then we set a pretrans linkAll.preTrans([0.0,-0.18,0.09])# - Distance between marker and view for spot in spotList: linkAll.setOffset(spot[0]) # - This "teleports" the subject to the location of desire linkAll.postEuler(spot[1], target=viz.LINK_ORI_OP) #changing the orientation of view in headset linkAll.preEuler(spot[1], target=viz.LINK_POS_OP) #changing the "axis" of the ppt for target in spot[2]: currentEuler = viz.MainView.getEuler() linkAll.postEuler([-currentEuler[0],0,0], target=viz.LINK_ORI_OP) #setting the postEuler back to 0 linkAll.preEuler([-currentEuler[0],0,0], target=viz.LINK_POS_OP) #setting the preEuler back to 0 linkAll.postEuler(target[0], target=viz.LINK_ORI_OP) linkAll.preEuler(target[1], target=viz.LINK_POS_OP) #now we turned to subject into the direction we wanted doSomething() currentEuler = viz.MainView.getEuler() linkAll.postEuler([-currentEuler[0],0,0], target=viz.LINK_ORI_OP) #setting the postEuler back to 0 linkAll.preEuler([-currentEuler[0],0,0], target=viz.LINK_POS_OP) #setting the preEuler back to 0 #now we set back everything before we start with the next spot Some days ago everything seemed to work but then i had the problem that the preTrans didn't work with the changed orientation. So i'm currently confused if i understood the methods from the viz module at all or if i'm using a code that is overcomplicating things too much? any hints are welcome |
#2
|
|||
|
|||
The solution was, using postEuler on viz.LINK_FULL_OP and instead of moving the subject with a Offset i moved the world of the subject. Now works also with the preTrans.
still don't know why preEuler didn't work but happy with my easy solution |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Working w/ multiple scripts | FlyingWren | Vizard | 3 | 10-16-2003 01:05 PM |