WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   avatar_sensor_speed (https://forum.worldviz.com/showthread.php?t=3959)

Veronika 10-11-2011 03:50 AM

avatar_sensor_speed
 
hello,

I want to walk with avatar via patriot. I need to walking in the big room. but patriot has only small range of source - up to 5 feet (1.52 meters). I need to set, if the patriot sensor is on the calibration place, the speed of avatar is 0. and if the sensor is moving in some direction, the avatar is moving in the same direction. I have set it. but I don't know, if the sensor is near to the calibration place, the speed of avatar is small, and if the sensor is further from this place, the speed is more. Is possible it to set?

thanks

Jeff 10-11-2011 04:52 PM

If you are using the code from your previous thread you could multiply the position of the sensor by some factor based on it's distance from the source:
Code:

import vizmat
def updateAvatar():
        pos=tracker.getPosition()
        ori=tracker.getEuler()
       
        distance = vizmat.Distance([0,0,0],[pos[0],0,pos[2]])
        if distance <= 0.5:
                speedFactor = 1
        elif distance > 0.5 and distance <= 1:
                speedFactor = 1.25
        else:
                speedFactor = 1.5
       
        avatar.setPosition([pos[0]*speedFactor,0,pos[2]*speedFactor])
        avatar.setEuler([ori[0],0,0])
       
vizact.onupdate(0,updateAvatar)


Veronika 10-11-2011 11:30 PM

it's perfect code. thank you very much :)


All times are GMT -7. The time now is 09:50 PM.

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