WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   move with avatar and patriot (https://forum.worldviz.com/showthread.php?t=4150)

Veronika 02-27-2012 12:55 AM

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

Veronika 02-28-2012 03:23 AM

I found a mistake :) now it's ok :)


All times are GMT -7. The time now is 04:28 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC