View Single Post
  #2  
Old 08-25-2009, 12:26 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
It seems like you simply want to run some code every frame. In that case you can register a timer function, which will be called every frame. Here is an example that plays a sound when the Z position of the view passes 3 meters:
Code:
import viz
viz.go()

viz.add('tut_ground.wrl')

def CheckView():
	"""Plays a sound when Z position of view is greater than 3"""
	x,y,z = viz.MainView.getPosition()
	if z > 3:
		# Play sound and unregister timer function
		viz.playsound('elaugh1.wav')
		return vizact.EventRemove
vizact.ontimer(0,CheckView)
Reply With Quote