In this section of the tutorial we'll see how to animate an avatar with tracking data. Vizard's avatar IK library supports a variety of tracker configurations to animate part or all of an avatar. Here we'll explore a simple desktop setup with two virtual trackers, one for the head and one for the right hand.
First create a folder (e.g. Avatars and Tools Tutorial) on your desktop to save the files that will be created in this tutorial. From the Tools tab in Vizard, select the Vizconnect option. From the Vizconnect Startup page, select option 3 to go to the Advanced Menu. Click the Save As button in the lower left corner of the GUI, navigate to your tutorial folder on the desktop, and save the configuration as vizconnect_config.py. All changes made to the configuration will automatically be saved in this file.
The trackers added here will be used later to animate the avatar. From the Trackers tab click Add a New Tracker, select the Mouse and Keyboard Walking option, and click Apply & Exit.
Click Add a New Tracker again, select the Mouse Scrollwheel option, and click Apply & Exit. Look in the Status window as you move the scrollwheel and you'll see that only the Z data changes. Although this tracker only provides 1 DoF data it is sufficient for moving a hand forwards and backwards.
From the Avatars tab, click Add a New Avatar, select the Male 2 option, and click Apply & Exit. The avatar, located at the world origin, is visible if you navigate backwards a few meters.
From the Displays tab, click Add a New Display, select the Custom Window option, and click Apply & Exit. The Custom Window is automatically linked to the avatar's head attachment point:
There are three attachment points (head, r_hand, l_hand) on the avatar. These points are not related to avatar IK setup. They are convenient locations on the avatar for linking the viewpoint, tools, and other objects to. Here the viewpoint is linked to the head attachment giving us a 1st person avatar perspective. This will become more obvious once the avatar is animated.
Open the Animator Selection dialog box. Trackers can be assigned to various avatar parts using the Inverse Kinematics animator. Click the button to assign a tracker for the head and select the options shown below:
Click the button to assign a tracker for the right hand and select the options shown below:
The child of parameter is set so the hand's movements are relative to the head. This is necessary because the scrollwheel tracker only provides Z position data. This parameter can also be useful when using physical trackers if one is 6DoF and others are 3Dof.
After you've finished configuring the head and right hand click Apply & Exit to close the animator dialog box. Go to the graphics windows and experiment with different mouse and key movements. Look down to see the avatar's body and scroll the wheel to move the hand in and out. Use the arrow keys to move the avatar around the environment.
You may have noticed that the avatar's hand is centered in relation to its head and body due to the lack of X data from the tracker. To change this, add a small offset to the scrollwheel tracker. From the Trackers tab, select Mouse Scrollwheel, and open the Offsets dialog box. Add the following value to the X field.
Move the hand in and out and you'll see its off to the right in a more natural position.
For a 3rd person view of the avatar simply parent the display and its viewpoint to a different object. Let's add a sub-window with a second viewpoint fixed in front of the avatar.
From the Displays tab, click Add a New Display, select the Custom Window option, and click Apply & Exit. With custom_window2 selected, open the Size/Position dialog box and increase both the width and height parameters to 0.4. The larger sub-window will give us a better view of the avatar.
From the Trackers tab, click Add a New Tracker, select the Group tracker option, and click Apply & Exit. To change its position and orientation open the Offsets dialog box and enter the following values:
In the scene graph tree, drag custom_window2 under group:
Now you should see the avatar from a 3rd person viewpoint in the sub-window. From this perspective it's easy to see how the right hand and head are linked in their movements.