PDA

View Full Version : World Transformations


c4am95
10-31-2010, 02:08 PM
Hello. I'm using an HMD and intersense tracker. Code-wise, I use methods like "link.postTrans", etc. to apply virtual world transformations when using the HMD directly. However, I want to use the environment for testing as well, so I'm trying to find an easy way to apply world transformations without the tracker. It's surprisingly not as easy as I thought it would be. How could I, for example, rotate the entire world 180 degrees so that the camera is situated in the same position and now facing the other way, but the virtual subject it represents hasn't physically turned around?

Jeff
11-02-2010, 12:32 PM
You can link the viewpoint to a mouse/keyboard tracker and apply a link operator to that:
import viz
viz.go()

gallery = viz.addChild('gallery.ive')

import viztracker
tracker = viztracker.KeyboardMouse6DOF()

link = viz.link(tracker,viz.MainView)
link.postEuler([180,0,0])

Does this do what you want?

c4am95
11-07-2010, 11:53 AM
this could work. but how do you change the properties of viztracker? for example, if i only want movement in x and z (no flying), how do i reduce the degrees of freedom?

Jeff
11-08-2010, 09:10 AM
Does the following work for you?

import viz
import vizact

viz.go()

gallery = viz.addChild('gallery.ive')

import viztracker
tracker = viztracker.KeyboardMouse6DOF()

fixedTracker = viz.addGroup()

link = viz.link(fixedTracker,viz.MainView)
link.postEuler([180,0,0])

def updateView():
x,y,z = tracker.getPosition()
fixedTracker.setPosition(x,1.8,z)
fixedTracker.setEuler(tracker.getEuler())

vizact.ontimer(0,updateView)

c4am95
11-09-2010, 12:50 PM
yeah that works well. albeit, it made the eyeheight incredibly high for some reason. when i used instead:
fixedTracker.setPosition(x, 0, z)
it looked normal. bizarre?