WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   More on avatar animations (https://forum.worldviz.com/showthread.php?t=209)

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
male.act(7)
#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

Hi,

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?

Thanks!

farshizzo 09-20-2004 04:37 PM

Hi,

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:
Code:

import viz
viz.go()

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

def ontimer(num):
        text.time += viz.elapsed()
        text.message('%d::%.2f'%(int(text.time/60.0),text.time%60.0))

viz.callback(viz.TIMER_EVENT,ontimer)
viz.starttimer(0,0.01,viz.FOREVER)



All times are GMT -7. The time now is 02:56 PM.

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