WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   More on avatar animations (

vjonshih 09-20-2004 03:49 PM

More on avatar animations
Hi there,

This is a tough question to explain in text, but I'll try my best:

In regards to this this previous post,

I attempted to start a timer to freeze an avatar's actions in the middle of an animation -- so the code went something like this:

#Perform the action
#Start a timer to freeze the avatar after 85% of the action has #been performed
viz.starttimer(FREEZE_AVATAR,male.getduration(7) * 0.85)

However, I noticed that the timing of the action's duration was not consistent -- each time I ran the script, the avatar would stop at a different point in the animation. Similarly, if I removed the male.getduration(7) * 0.85 parameter and just simply put 1.5 (for 1.5 seconds), 1.5 seconds seemed to be measured differently each time I ran the script. Is there a way to get around this and to get a standardized measure of time?

Thanks a lot in advance!

farshizzo 09-20-2004 04:10 PM


What framerate does your script run at? If your framerate is too low then a lot of time based functions can act rather inconsistently. Also, how inconsistent were the timings? An inconsistency of a frame or so is to be expected.

vjonshih 09-20-2004 04:21 PM

Thanks for the reply -- I ran it again and there seems to be no more timing issues.

I have one more question regarding time:

We made a script that uses a timer callback function simply displays a running clock in the world (going from 0:00 to 0:01, etc.) and the time runs much faster than realtime. How do we make the running clock run in realtime?


farshizzo 09-20-2004 04:37 PM


Are you running this script on a laptop computer? Vizard uses CPU clockspeed to determine elapsed time, and most laptops have variable CPU speeds in order to save power, which causes inconsistencies in timing.

If you aren't using a laptop then I've included a sample script which displays the elapsed time on the screen. Make sure you are doing something similar to this:

import viz

text = viz.add(viz.TEXT3D,'0',viz.SCREEN)
text.time = 0

def ontimer(num):
        text.time += viz.elapsed()


All times are GMT -7. The time now is 12:04 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC