Vizard 8 » Reference » Avatars » Bones
8.0

Bones

Bones make up the skeleton of the avatar and are used to move the avatar's limbs.  When avatar's play built-in animations, they are moving the bones according to the data encoded in the animation file.  You can also move an avatar's bones within a Vizard script.  Moving bones with a script allows you to modify the movement of the avatar in response to a changing environment.  For example, you could move an avatar's arm bones so that they are always pointing at a moving object.  

 

For additional information, check out the Tutorial: Animating bones for an example which makes the avatar's head continually look at the view.  

Moving Bones

To move a bone, you must understand the avatar's skeleton.  The skeleton defines a hierarchy of bones, so the "right forearm" bone is the parent of the "right hand" bone.  Any movement of the forearm bone will also move the hand bone.  The root of the bone hierarchy is in the pelvis and is known as the center of mass.  To get a handle to one of the bones in the hierarchy call the <avatar>.getBone(<boneNameString>) method.  Remember, you can see all of the avatar's bones in Vizard's resources window.  

 

By default, all the bones are "unlocked" and are set to be moved by the avatar's built-in animations.  To "lock" the bones and keep the built-in animations from overwriting your manual bone manipulation call the <bone>.lock() method.  The built-in animations will still move the bones of the avatar that are unlocked.  You can call the <bone>.unlock() method to return the bone to built-in animation control.  

 

Bones are moved by rotating them about their connection to their parent bone.  Usually bones do not stretch, so don't change the position of bones when you are trying to create realistic movement.  

# Make me an avatar
male = viz.add('vcc_male.cfg')
# Grab a handle to the right upper arm bone
armBone = male.getBone('Bip01 L UpperArm')
# Don't move the bone with built-in animations
armBone.lock()
# Raise arm
armBone.setEuler(50, 0, 0)

By default, bones are rotated in their parent bone's coordinate system.  You can change the coordinate system when your transformation is applied by adding another parameter, just like with geometry nodes.  This code rotates the bone in the coordinate system for the whole avatar.  

armBone.setEuler(90, 0, 0, viz.AVATAR_LOCAL)

Attaching an object to a bone

Vizard also allows you to attach objects to the bones of your avatars.

male = viz.add('vcc_male.cfg')
ball = viz.add('ball.wrl')
head = male.getBone('Bip01 Head')
viz.link( head, ball )

See also

In this section:

Avatar basics

Built-in animation

Actions that animate

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

Example scripts:

Bones