View Single Post
  #1  
Old 02-27-2012, 12:55 AM
Veronika Veronika is offline
Member
 
Join Date: Jan 2010
Posts: 22
move with avatar and patriot

Hello, I have script:
Code:
#add avatar
avatar=viz.add('male.cfg')
avatar.state(2)

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

#set the move and speed
import vizmat
def updateAvatar():
	pos=patriot.getPosition()
	ori=patriot.getEuler()
	
	p1 = [0,0,0]
	p2 = [pos[0],0,pos[0]]
	distance = vizmat.Distance(p1,p2)
	if distance <= 0.1:
		speedFactor = 4
	elif distance > 0.1 and distance <= 0.8:
		speedFactor = 7
	else:
		speedFactor = 9
	
	avatar.setPosition([pos[0]*speedFactor,0,pos[0]*speedFactor])
	avatar.setEuler([ori[0],0,0])
	
vizact.onupdate(0,updateAvatar)
But when I move with sensor of Patriot, avatar is moving only in one line, no anywhere in axis x and y.
could you help with this?

Thanks
Veronika
Reply With Quote