PDA

View Full Version : timer


paulpars
06-14-2006, 09:51 AM
I am trying to create something so when the viewpoint enters a hotspot a person appears walking in the world. The problem is that I only want the person to appear for 5 seconds and then disappear again. I make the person show up within a timer function and I can't seem to figure out how to set up some other timer so the person only appears for a certain amount of time...I've tried using a director funciton too but can't seem to get it to work. Does anyone have any ideas?

Gladsomebeast
06-14-2006, 10:26 AM
Start another timer in the code that makes the person appear. Start the timer with a unique timer number so you know when this timer ends. When the timer callback function is called with the unique timer number, call visible( viz.OFF ) on the avatar.

#With the code that starts the avatar
viz.starttimer( HIDE_AVATAR_TIMER, 5 )


#Timer callback
def myTimer( num ):
if num == HIDE_AVATAR_TIMER:
avatar.visible( viz.OFF )

paulpars
06-14-2006, 02:31 PM
ok i got it figured out..the problem was that i was calling the timer from within another timer which made the person visible and refreshed at a very fast rate. i just created a new function and put it outside the timer and it works now..thanks!