Vizard 7 » Reference » Avatars » Built-in animation
7.6

Built-in Animation Basics

Avatars can have animations, or poses that can contain movement, encoded within their Cal3D files.  These are known as built-in or stock animations and numbered starting at 1.  Built-in animations are created in modeling programs, such as 3ds Max, and exported in the avatar's Cal3D files.  You can see all of the available built-in animations for a loaded avatar through the resources view.

 

Built-in animations are the primary method for controlling the pose of avatars.  Animations with complex and realistic movement are much easier to create in modeling programs and are more practical than programmatically moving avatar limbs via bones.  Another advantage of built-in animations is that they can be blended together.  This avoids unsightly jumping or limb teleporting when avatar transition between animations.

Performing Animations

You can set an avatar's state to have them perform an animation over and over.  Often you would set the state to some animation which has been created to loop, such as the standing idle or walking animations.

# Create avatar and make him stand naturally
dude = viz.add('vcc_male.cfg') #add avatar
dude.state(12) #looping idle animation

When you would like your avatar to react to something temporarily you can tell the avatar to execute an animation.  This will cause the avatar to run the animation once and then return to the state animation.

# Create avatar and make him stand naturally
dude = viz.add('vcc_male.cfg') #add avatar
dude.setPosition( 0, 0, 5 )
dude.setEuler( 180, 0, 0 )
dude.state(12) #looping idle animation
...
dude.execute(5) #run number 5 animation once

Queuing Animations

When animating avatars, the Action system provides a good framework for queuing up and organizing animations.  The vizact.animation( animationNumber, fadeIn, fadeOut ) action executes an animation.  The fade parameters specify in seconds how long Vizard should blend the animation in and out.  

#Position avatar in view
avatar = viz.add( 'vcc_male.cfg' )
avatar.setPosition( 0, 0, 5 )
avatar.setEuler( 180, 0, 0 )
avatar.idlepose( -1 ) #don't set avatar state to animation 1 when actions complete

#Queue up animations 5 and 6 to play one after the other
avatar.addAction( vizact.animation(5) )
avatar.addAction( vizact.animation(6) )

Precise Animation Timing

Avatar's can jump to a given time in an animation with the <avatar>.setAnimationTime() method.  You can control the speed at which animations are executed with the <avatar>.setAnimationSpeed() method.

dude.execute(12) #idle animation
dude.setAnimationTime(12, 1.5) #go 1.5 seconds into the animation
dude.setAnimationSpeed(12, .5) #run at half speed
print( dude.getAnimationTime(12))

See also

In this section:

Avatar basics

Actions that animate

Bones

Avatar command table

Other sections:

Tutorial: Animating Avatar bones -- Tutorial for performing actions on objects.

Tutorial: Animating Avatars -- Tutorial for performing actions on avatars.

3D Model transform basics

Action basics

Event Reference

Example scripts:

Motions

Bones