I have a problem in that I want to go (via increments of 0.01) from 0 to 1 (that bit is easy) if an external condition (which is being evulated automatically) is false and stop the counter if the condition is true.
The condition is if a collision has occured between two objects. I know this part works correctly since I have tested it manually and within a loop. But stopping the counter if a collision has occured is proving tricky. I'm sure it is something very very simple that I'm missing out.
def autoHandClose():
global collisionDeteched # this is set to false but on collision correctly changes to true
counter = 0
for x in range(100):
if collisionDeteched == False:
counter = counter + 0.01
h.setGesture(hand.GESTURE_FIST, closeThumb=True, weight = counter)
else:
break
The weight parameter is from 0 to 1 (hence the reason why I want to go from 0 to 1 to close the hand) I can close the hand but can't get it to stop if a collision is detected. This method is assigned to a keyboard button press.
I'm guessing the logic is wrong, right?