View Single Post
Old 03-06-2013, 10:39 AM
Frank Verberne Frank Verberne is offline
Join Date: Mar 2008
Location: Netherlands
Posts: 148
OK, solved the issue. Now my next question is: I have a blink left and a blink right morph. I would like the left eye and right eye to blink at the same time. Using the blinking code, I've tried this:
#Blink morph ID of avatar
#Action that will animate blink closing
close_eye_left = vizact.morph(BLINK_MORPH_LEFT,1,0.1)
close_eye_right = vizact.morph(BLINK_MORPH_RIGHT,1,0.1)
#Action that will animate blink opening
open_eye_right = vizact.morph(BLINK_MORPH_RIGHT,0,0.1)
open_eye_left = vizact.morph(BLINK_MORPH_LEFT,0,0.1)
#Action that will wait 1-5 seconds
wait_blink = vizact.waittime(vizact.randfloat(1,5))
blinking_time_left = wait_blink
blinking_time_right = blinking_time_left
#Action that will blink indefinitely
blinkAction_left = vizact.sequence( blinking_time_left, close_eye_left, open_eye_left, viz.FOREVER )
blinkAction_right = vizact.sequence( blinking_time_right, close_eye_right, open_eye_right, viz.FOREVER )

#Add blink action to avatar
However, now the blinking of the left and right eye is not synchronized. I think that each time the blinkAction_left and blinkAction_right is called, a new value gets assigned to wait_blink. However, if I make wait_blink a fixed float, the blinking happens really fast (though in sync). If I increase the value of wait_blink, it does not increase the waiting time between blinks. How can I adapt this code to make blink morphs morph at the same (random) time?
Reply With Quote