WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   limiting object rotation (https://forum.worldviz.com/showthread.php?t=2978)

Philippe 09-21-2010 11:53 AM

limiting object rotation
 
Hi,

Is there a method enabling to limit the range of rotation of a tracking device (Euler) relatively to the orientation of another tracking device (in my case, I have a gun which orientation's follows the glove position, and I would like to limit the orientation of the gun so that it cannot point backwards but only forwards - i.e. limiting the yaw of the gun to a range from -90 degrees to +90 degrees relatively to the current direction of the HMD).

Is there a simple way to do this?
In order words, I would like not to enable the gun to point backwards (this is some workaround solution: due to some tracking issues, it happens that the gun suddenly "flips back" and stays pointing backwards even when the glove stays more or less in the north direction ; I would like to have the glove never identified as pointing south).

Thanks,
Philippe.

Chapre 09-21-2010 02:30 PM

You could reset the yaw to 90 degrees or -90 degrees everytime the gun try to go beyond the limit.
Ex:
rho=gun.getEuler()
if 90 < rho[0] < 180:
---> rho[0]=90
elif -180 < rho[0] < -90:
---> rho[0]=-90
gun.setEuler(rho)

Philippe 10-07-2010 12:40 PM

Thanks a lot !

Philippe 10-07-2010 12:51 PM

But where should I put such a code in the viztracker file? I would like to have this check permanently running - should I put it in the _addTracker() method ?

Philippe 10-07-2010 01:07 PM

Actually, I think that the best way is to use:

def udpateGunPosition():
(the code)

and then use

vizact.ontimer(0,udpateGunPosition)

in the main program.
This should do the job, right?

masaki 10-07-2010 04:31 PM

Hi,

Can you attach your script and I can take a look.

Thanks,
Masaki


All times are GMT -7. The time now is 08:10 AM.

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