WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-20-2004, 03:49 PM
vjonshih vjonshih is offline
Member
 
Join Date: Sep 2004
Posts: 15
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!
Reply With Quote
  #2  
Old 09-20-2004, 04:10 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #3  
Old 09-20-2004, 04:21 PM
vjonshih vjonshih is offline
Member
 
Join Date: Sep 2004
Posts: 15
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!
Reply With Quote
  #4  
Old 09-20-2004, 04:37 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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)
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 08:31 AM.


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