#1
|
|||
|
|||
Yield until joystick is deflected by a certain degree
I've read the example scripts of yield statement, but I don't know how to realize this function: The function won't go to the next line until the user deflected the joystick beyond a certain degree. Here's my code:
HTML Code:
def pointing_task(joystick) some codes return angle,result ##result is false means the joystick isn't deflected beyond a certain threshold def start_pointing(): angle,result = pointing_task(joystick) yield result == True ?? some codes viztask.schedule(start_pointing()) Thanks a lot! |
#2
|
|||
|
|||
have the pointing_task method be a loop that constantly is checking for joystick position. waits a few ms, then checks again.
something like while( joystick position is not facing the right way) yield viz.waittime(.01) #i forget the method This way the loop will keep going and only exit until and continue with the rest of the program when the joystick is in position. the yield statement in the method makes other yield statement calling it actually wait and pause the program. (dont know why vizard does it this way but thats just how it is) |
#3
|
|||
|
|||
Thanks a lot!
|
Tags |
joystick, yield |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Yield until joystick is deflected by a certain degree | Qiliang He | Vizard | 1 | 11-18-2015 09:41 AM |
Unexpected Avatar lookAt() behavior when using yield statements | chris2307 | Vizard | 2 | 12-17-2013 02:58 AM |
Changing Joystick navigation halfway through | kmkm | Vizard | 1 | 07-01-2013 07:02 PM |
joystick position | nmohandes | Vizard | 2 | 01-16-2012 10:03 AM |
Facetracking and Immersion Joystick | Vygreif | Vizard | 1 | 01-25-2006 10:56 AM |