WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-16-2016, 11:57 AM
jelly jelly is offline
Member
 
Join Date: Feb 2016
Posts: 38
Proximity Manager - How to implement delay

Hello,

I have a timing issue in my script, as I am not sure how to implement a delay, in that when the proximity sensor is entered, a variable (handstate) changes only after 2 seconds have elapsed.

That variable change triggers a certain action in a different function, but to keep it simple, I have copied below the proximity function I have:

Code:
def EnterProximity_IndexFinger(e): # decide what happens on sensor entry
	global handstate
	e.sensor == SensorIndexFinger 
	handstate = 1
	print "sensor A entered"
	print condition
manager.onEnter(SensorIndexFinger,EnterProximity_IndexFinger)
So far, I tried to not change the handstate inside the proximity function but to use it to call another function that has a delay implemented. Something like this:

Code:
def Change(): 
        global handstate
        yield viztask.waitTime(2)
        handstate = 1


def EnterProximity_IndexFinger(e): # decide what happens on sensor entry
	global handstate
	e.sensor == SensorIndexFinger 
	print "sensor A entered"
        yield Change()
manager.onEnter(SensorIndexFinger,EnterProximity_IndexFinger)
Another thing I tried is to not use the "manager.onEnter" it but the "yield vizproximity.waitEnter". However, I must be doing something wrong as neither method works.

I reckon it must not be too tricky to achieve this - in essence I just want a 2 second delay after proximity sensor was entered before my action is triggered. But I am not sure how to achieve this. I would be very happy to receive some ideas or help!

Best,
J
Reply With Quote
 

Tags
proximity, proximity sensor, timing

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
Proximity Sensing Using Kinect JamesCakes Vizard 6 06-24-2016 05:52 AM
Orientation selective (Viewing Vector) Proximity Sensor lmGehrke Vizard 2 03-17-2015 12:31 PM
Proximity Sensor Problem kmkm Vizard 3 03-04-2014 11:54 AM
Phase Space and Proximity Sensors snovob93 Vizard 3 06-13-2012 12:32 PM
Packager manager Chapre Vizard 1 04-29-2011 09:16 AM


All times are GMT -7. The time now is 03:18 AM.


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