#1
|
|||
|
|||
linking viewpoint to viz.node
Some background first:
I have a project in which the mainview is linked to 6DOF data recorded when walking with HMD. There are some transforms in between the data from the tracker and the position/orientation in the virtual world, implemented with pre and post actions on the link. The 6DOF data from the tracker as well as transformed to the virtual world are stored to file. Now, I'd like to replay this data. So simply use the stored tracker position/orientation data as input to the link transform chain to generate the same frames/views as during previous walking (there are other things going on in the code, changing as little as possible by simply providing fake/replayed tracker data is the best solution to implement what I want). I thought I could easily do this by simply using an empty node (viz.addGroup()), setting its position and orientation each frame and using that in place of the tracker linkable as source for the link with mainview. However, the orientation data is ignored, that is, the mainview is oriented always as if all input orientation data is 0. Code:
trackerLinkable = viz.addGroup() fileReader = MatFileReader() vizact.onupdate(viz.PRIORITY_PLUGINS,fileReader.getNextRealPosOri,trackerLinkable) # see below for relevant bits headLink = viz.link(headTrack, viz.MainView) vizact.onupdate(viz.PRIORITY_PLUGINS+2,headLink.update) # viz.PRIORITY_PLUGINS+1 reserved #headLink.postEuler(), etc... class MatFileReader(): def getNextRealPosOri(self,output=None): # get next rawPos and rawOri from loaded file if output is not None: output.setPosition(rawPos) output.setEuler(rawOri) print (output.getPosition(),output.getEuler()) # prints what is expected. e.g. getMatrix() also looks right Code:
print (viz.MainView.getPosition(),viz.MainView.getEuler()) A second problem I have is that this appears to run at 30 Hz instead of 60. Am I doing something very suboptimal causing the slowdown? What have I forgotten? Is there a better way to implement something like this? Thank you! Last edited by dcnieho; 11-03-2014 at 01:05 AM. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to track the actual viewpoint | Jerry | Vizard | 3 | 05-25-2016 09:44 AM |
Moving main viewpoint when linked to PPT | v-clizzin | Precision Position Tracker (PPT) | 1 | 04-20-2010 04:09 PM |
Avatar w/ hat cannot look at viewpoint | TrashcanPatrol | Vizard | 5 | 08-19-2008 08:26 AM |
3d viewpoint movement | spacefarer | Vizard | 9 | 07-25-2006 03:37 PM |
VRML Viewpoint error | bstankie | Vizard | 1 | 03-11-2003 02:10 PM |