WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-17-2015, 04:11 AM
lmGehrke lmGehrke is offline
Member
 
Join Date: Dec 2014
Posts: 3
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!
Reply With Quote
  #2  
Old 03-17-2015, 07:44 AM
mape2k mape2k is offline
Member
 
Join Date: Mar 2013
Posts: 60
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()
Reply With Quote
  #3  
Old 03-17-2015, 01:31 PM
lmGehrke lmGehrke is offline
Member
 
Join Date: Dec 2014
Posts: 3
hi,

thanks, exactly what i needed!
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unusual tracker sensor setup with Vizard Zhi Vizard 2 06-12-2012 10:52 AM
sensor or not sensor? nige777 Vizard 0 03-29-2011 05:03 AM
problem in setting the orientation of bones bharatbhushan Vizard 0 06-30-2009 05:30 AM
wiimote and sensor bar masaki Vizard 1 03-06-2008 04:07 PM
Multiple Copies of same sensor plugin RedSpikeyThing Plug-in development 2 02-12-2008 03:10 PM


All times are GMT -7. The time now is 06:12 AM.


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