View Single Post
  #4  
Old 09-23-2005, 09:31 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

Yes, you can play to actions at the same time. When you add actions to objects you can specify which action pool to add it to. Action pools allow you to run multiple actions on objects in parallel. Please have a look in the documentation under the Actions section.

For example, lets say you wanted to perform a speak action and animation action in parallel:
Code:
#Create an action to play animation 3
anim = vizact.animation(3)

#Create an action to speak 'words.wav'
words = vizact.speak('words.wav')

#Play both actions on the avatar simultaneously
avatar.add(anim,1)
avatar.add(words,2)
To stop a current action from running you would do the following:
Code:
avatar.clear(viz.CURRENT_ACTION,pool)
This will stop any current actions being performed on the avatar on the specified pool. Currently, the speak action will not stop the sound from being played when it is cleared, so you will have to stop it manually:
Code:
viz.playsound('words.wav',viz.STOP)
On a side note, I had some free time and was able to create a version of the speak action which will keep the mouth movement in sync with the audio file. I tried it on a wav that was 5 minutes long and it seemed to work fine. I will include it in the next update to Vizard. If you wanted, I could supply you some code to get it working in the current version.
Reply With Quote