WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Orientation selective (Viewing Vector) Proximity Sensor (https://forum.worldviz.com/showthread.php?t=5312)

lmGehrke 03-17-2015 03:11 AM

Orientation selective (Viewing Vector) Proximity Sensor
 
For a research paradigm I want to implement a proximity sensor that is activated when a subject is looking, facing its heading direction towards a certain object. I could only find the proximity sensor function for certain positions and not orientation.

So I would like something like this:

Code:

initialHeadingPole = viz.add('pole.wrl')
initialHeadingPoleSensor = vizproximity.Sensor(vizproximity.RectangleArea([3,2]), source=initialHeadingPole)

manager = vizproximity.Manager()
manager.setDebug(viz.ON)
#debugEventHandle = vizact.onkeydown('d',manager.setDebug,viz.TOGGLE)
#Add main viewpoint as proximity target
target = vizproximity.Target(viz.MainView)
manager.addSensor(initialHeadingPoleSensor)

Any help would be greatly appreciated!

mape2k 03-17-2015 06:44 AM

Hi,

you don't need sensors to do that. I would rather use a timer to call a function every frame that constantly checks the view direction and sends a signal when a certain value is reached, e.g.:

Code:

import viz
import viztask


arena = viz.addChild('pit.osgb')

angleSignal = viztask.Signal()
checkedAngle = 90                # at which view angle should the sensor be activated?


def checkViewAngle():
        [yaw,picht,roll] = viz.MainView.getEuler()
       
        if int(yaw) == checkedAngle:
                angleSignal.send()
                print('Angle detected!')

orientationSensor = vizact.ontimer(0,checkViewAngle)        # start the function

viz.go()


lmGehrke 03-17-2015 12:31 PM

hi,

thanks, exactly what i needed!


All times are GMT -7. The time now is 03:25 PM.

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