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 Code:
def Change(): 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 |
Use the vizproximity.waitEnter command within a task function:
Code:
import viztask |
Dear Jeff,
thank you for the help, this seems like the way to go! But I have some problems with it: I noticed that adding the line Code:
viztask.schedule(proximityTask()) My question would be how do I make it happen everytime, like it was the case when I used Code:
manager.onEnter(SensorIndexFinger,EnterProximity_IndexFinger) Code:
SensorIndexFinger = vizproximity.Sensor(vizproximity.Box([0.03,0.03,0.03],center=[0,0,0]),IndexFinger) I would be very happy to hear if you had any suggestions on how to call the action (with delay) every time the sensor was entered, as I can't seem to find a way to implement it :o |
You can add a loop inside the task function:
Code:
def proximityTask(): |
Thank you so much, Jeff, this works perfectly!
|
All times are GMT -7. The time now is 03:30 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC