WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-23-2009, 10:56 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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)
Reply With Quote
  #2  
Old 11-24-2009, 12:58 PM
billjarrold billjarrold is offline
Member
 
Join Date: Jul 2009
Location: San Francisco Bay Area
Posts: 39
Thanks very much.

One oddity...the manual does not mention that morph has a 3rd argument. What does this third argument mean?
Reply With Quote
  #3  
Old 11-24-2009, 12:59 PM
billjarrold billjarrold is offline
Member
 
Join Date: Jul 2009
Location: San Francisco Bay Area
Posts: 39
Here is what the manual page for <node3d:face>.morph says....

<node3d:face>.morph
Set the percentage of a morph



<node3d:face>.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.
Reply With Quote
  #4  
Old 11-24-2009, 01:16 PM
billjarrold billjarrold is offline
Member
 
Join Date: Jul 2009
Location: San Francisco Bay Area
Posts: 39
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).
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vizard tech tip: Using the Python Imaging Library (PIL) Jeff Vizard 0 03-23-2009 11:13 AM
problem with exporting avatars and using them in Vizard VDong Vizard 2 02-23-2009 01:25 AM
Vizard tech tip: Text to Speech Jeff Vizard 1 01-15-2009 09:39 PM
animating built-in vizard male and female avatars vAlexia Vizard 2 09-19-2006 01:06 PM
changing the color of Shirt of Vizard Avatars Amit Vizard 2 09-02-2005 08:00 AM


All times are GMT -7. The time now is 05:42 AM.


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