WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Vizard tech tip: Blinking Avatars (https://forum.worldviz.com/showthread.php?t=1983)

Jeff 04-23-2009 10:56 AM

Vizard tech tip: Blinking Avatars
 
Vizard's vcc avatars come with morph targets for blinking, eyebrow raising, and talking. Check out the following snippet of code to get your avatars to blink.

Code:

import viz
viz.go()

female = viz.add('vcc_female.cfg', pos = [0,.3,1], euler = [180,0,0])
female.state(1)

#Blink morph ID of avatar
BLINK_MORPH = 0

#Action that will animate blink closing
close_eye = vizact.morph(BLINK_MORPH,1,.1)

#Action that will animate blink opening
open_eye = vizact.morph(BLINK_MORPH,0,0.1)

#Action that will wait 1-5 seconds
wait_blink = vizact.waittime(vizact.randfloat(1,5))

#Action that will blink indefinitely
blinkAction = vizact.sequence( wait_blink, close_eye, open_eye, viz.FOREVER )

female.addAction(blinkAction)

Try changing this code to move the eyebrows. The morph targets are listed in the vcc_avatars .cfg files. When specifying the morph id use the number order it appears in the list of morphs, beginning with 0. So to use the eyebrow morph in Vizard you would set
Code:

EYEBROW_MORPH = 1
In order to run two actions in parallel, like blinking and eyebrow raising make sure you add the actions to different action pools. The documentation explains how action pools work. In the following line of code the blink action is added to action pool 1. If the pool is not specified, by default, the action will be added to pool 0.
Code:

female.addAction(blinkAction, pool = 1)

billjarrold 11-24-2009 12:58 PM

Thanks very much.

One oddity...the manual does not mention that morph has a 3rd argument. What does this third argument mean?

billjarrold 11-24-2009 12:59 PM

Here is what the manual page for .morph says....

.morph
Set the percentage of a morph



.morph(
num
percent

)

...see the first number is num, the second is percent and their is no third argument specified. I'm finding that when I delete your 3rd argument, I get an error.

billjarrold 11-24-2009 01:16 PM

Ah, I've answered my own question....

The third argument appears to be a speed related argument. 0.1 is a fast blink. 0.9 gives us a very slow blink.

(I determined this by trying the code verbatim above....I first tried it on my own code and I am not getting good results).


All times are GMT -7. The time now is 09:13 AM.

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