PDA

View Full Version : walking of avatar via patriot


Veronika
09-30-2011, 03:20 AM
Hi,

I want to set the avatar and sensor, that the sensor is on the place, when the calibration was, in the virtual place the avatar stands too and subsequently, into which the direction the sensor is moving, so in the virtual world avatar is moving in the same direction. But my avatar is always rotated around all axis. I use patriot. can you help me with this?

thanks

Jeff
09-30-2011, 07:10 PM
Do you want the avatar to only move X-Z for position and yaw for orientation? If so, you'll have to pull out just those values from the tracker data and apply them to the avatar's position and orientation.

Veronika
10-03-2011, 12:16 AM
yes, I need only this. But how I can pull out those values from track data and apply them to the avatar?

Jeff
10-04-2011, 03:01 PM
Within a function that gets called every frame you can get the tracker data as lists and extract the values you want to use. Something like the following:
def updateAvatar():
pos=tracker.getPosition()
ori=tracker.getEuler()
avatar.setPosition([pos[0],0,pos[2]])
avatar.setEuler([ori[0],0,0])

vizact.onupdate(0,updateAvatar)

Veronika
10-05-2011, 06:06 AM
I have this code:
import viz

viz.go()

#set main view (x,z,y)
viz.MainView.translate(0,2,-15)
viz.clearcolor(viz.GRAY)

#Connect to Patriot sensor
polhemus = viz.add('polhemus.dle')
patriot = polhemus.addPatriot()


avatar=viz.add('male.cfg')

#Link the hand to the Patriot data
viz.link(patriot,avatar)

def updateavatar():
pos=patriot.getPosition()
ori=patriot.getEuler()
avatar.setPosition([pos[0],0,pos[0]])
avatar.setEuler([ori[0],0,0])

vizact.onupdate(0,updateavatar)

and I want to walk with avatar and if sensor is further from calibration place, the speed of walking is more. But this code for update avatar isn't function. I whole day try to set this, but I don't know how. Can you help me with this?

Jeff
10-05-2011, 11:59 AM
Try removing the line where the avatar is linked to the Patriot data. That link is overriding the update function.

Veronika
10-07-2011, 12:33 AM
it's function :) thank you very much :)