WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   to rephrase my question... (https://forum.worldviz.com/showthread.php?t=237)

shai 10-26-2004 11:52 PM

to rephrase my question...
 
I'm sorry, if the first question seemed a bit ambiguous--

I'm trying to connect a few animations.

my first animation is a person that is sitting down,
the second animation is a person that is waving while sitting down, etc.

i'm trying to do this with the act method but it doesn't flow smoothly between the two animations. also, i need to make these animations in seperate files (that way I can control how many times I want to loop an animation in the middle.)

does anyone have a suggestion?

thanks

farshizzo 10-27-2004 10:08 AM

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)


shai 10-27-2004 10:55 AM

animation sequence
 
This is exactly what I was looking for--

thanks so much!


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

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