WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 11-22-2016, 11:07 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Try the following example. After the sensor enter event occurs in the proximity task another task is called that handles the delay:

Code:
import viz
import vizproximity
import viztask

viz.go()

dojo = viz.addChild('dojo.osgb')

#Create proximity manager
manager = vizproximity.Manager()
manager.setDebug(viz.ON)

#Add main viewpoint as proximity target
target = vizproximity.Target(viz.MainView)
manager.addTarget(target)

#Create sensor using static matrix
sensor = vizproximity.Sensor(vizproximity.Sphere(1.0),source=viz.Matrix.translate(0,1.5,3))
manager.addSensor(sensor)

def delayTask():
	yield viztask.waitTime(2)
	print '2 seconds elapsed'

def proximityTask():
	while True:
		yield vizproximity.waitEnter(sensor)
		print 'entered sensor'
		viztask.schedule(delayTask())

viztask.schedule(proximityTask())
Reply With Quote
 

Tags
proximity, proximity sensor, timing


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
Proximity Manager - How to implement delay jelly Vizard 4 11-18-2016 08:48 AM
timer question Elittdogg Vizard 5 10-10-2007 02:49 PM


All times are GMT -7. The time now is 09:49 PM.


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