View Single Post
  #2  
Old 03-17-2015, 06: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