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