WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 10-27-2004, 10:08 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

Sorry for the late reply. I was trying to get this working myself but I still get some flicker in between animations. I'll try to fix this in the next version so that animations can blend smoothly between one another. In the meantime you might have to do this manually.

The act method simply queues an action which calls the execute command of an avatar. The execute command simply executes the animation cycle once. I've included a sample script which shows how to do this manually. Let me know if you have trouble getting it to work. (Note, you must press the spacebar to start the animation sequence)
Code:
import viz
viz.go()

#Declare a timer constant
NEXT_ACTION = 0

#Add the avatar
male = viz.add('male.cfg')
male.translate(0,0,6)
male.rotate(180,0,0)

#Create list of actions to be executed
actions = [2,2,3]


def onkeydown(key):
	if key == ' ':
		#Start timer to execute actions
		viz.starttimer(NEXT_ACTION,0.01)

viz.callback(viz.KEYDOWN_EVENT,onkeydown)


def ontimer(num):
	if num == NEXT_ACTION:
		if len(actions) > 0:
			#Remove first animation from list
			animation = actions.pop(0)
			#Get the duration of the animation
			duration = male.getduration(animation)
			#Execute the animation (with 0.1 in/out delays)
			male.execute(animation,0.1,0.1)
			#Start a timer that will expire before next animation is finished
			viz.starttimer(NEXT_ACTION,duration - 0.1)
		else:
			print 'No more actions'

viz.callback(viz.TIMER_EVENT,ontimer)
Reply With Quote
 

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 03:47 AM.


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