WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Avatar animation (https://forum.worldviz.com/showthread.php?t=1186)

Joran 08-17-2007 06:09 AM

Avatar animation
 
Hello,

I am having some big problems with avatar animations. So here an example of something I can not get to work. I want an avatar, to fall dead, lay down for 2 seconds and then stand up again. Here my attempt:

Code:

import viz

viz.go()

man = viz.add('male.cfg')

def onKeyUp(key):
        if key == ' ':
                man.addAction(vizact.animation(7, freeze = True))
                man.addAction(vizact.waittime(2))
                man.addAction(vizact.animation(1))

viz.callback(viz.KEYUP_EVENT,onKeyUp)

And this doesn't work at all. How should I do it?

Greetings, Joran.

farshizzo 08-17-2007 09:44 AM

Hi,

The following code should do what you want using the viztask module:
Code:

import viz
viz.go()

male = viz.add('male.cfg',pos=(0,0,6),euler=(180,0,0))
male.state(1)

import viztask

def execute():
        while True:
       
                yield viztask.waitKeyDown(' ')
               
                #Execute animation with no delay out
                male.execute(7,delay_out=0.0)

                #Wait for animation to complete
                yield viztask.waitAnimationEnd(male,7)
               
                #Set animation state with no delay
                male.state(8,delay=0.0)
               
                #Restore standing pose after 1 second
                yield viztask.waitTime(2)
                male.state(1)

viztask.schedule( execute() )

If you prefer using actions, then the following code should work as well:
Code:

import viz
viz.go()

man = viz.add('male.cfg')

def onKeyUp(key):
        if key == ' ':
                man.addAction(vizact.animation(7,0,0))
                #Place avatar in laying state
                man.addAction(vizact.state_node(8,0.0))
                man.addAction(vizact.waittime(2))
                #Place avatar in standing state
                man.addAction(vizact.state_node(1))

viz.callback(viz.KEYUP_EVENT,onKeyUp)



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

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