Vizard 8 » Command Index » Vizard modules » viz » <viz>.addAvatar
8.0

<viz>.addAvatar

Adds an avatar.

<viz>.addAvatar(  
filename  
parent = viz.WORLD  
scene = viz.MainScene  
flags = 0  
)  
filename
Name of avatar file, typically ends with '.cfg'
parent = viz.WORLD
viz.WORLD
viz.SCREEN
viz.ORTHO
<node3d> object
scene = viz.MainScene
If the parent is viz.WORLD or viz.SCREEN, then the argument represents the scene to add the object to.
If the parent is viz.ORTHO, then the argument represents the window to add the object to.
If the parent is a valid node3d object, then the argument is ignored.
flags = 0
A combination of the following flags:

Flag

Description

viz.AVATAR_DELAY_LOAD

Delay the loading of all animations specified in the avatar cfg file until they are used for the first time. Useful for speeding up load time and reducing memory usage by not loading unnecessary animations. Using this flag will override any use of the delay_load option in the cfg file.

viz.LOAD_ASYNC

Load the model asynchronously. See remarks below.

Remarks

An avatar object can represent any character with a skeleton structure. The avatar can contain any number of animations and morph targets that can be dynamically blended together at runtime.

If the viz.LOAD_ASYNC flag is set, the avatar will be loaded asynchronously. In this case, the command will return immediately with a valid node handle. The status of the async operation can be queried using the <node3d>.getAsyncStatus command. When the async operation completes, due to either success or failure, a viz.ASYNC_EVENT will be triggered. The <vizact>.onAsyncLoad or <viztask>.waitAsyncLoad commands can be used to automatically process this event for a specified node.

Note: When loading asynchronously, most avatar commands will not work properly until the asynchronous operation has completed successfully.

Return Value

<node3d:avatar> object

Example

avatar = viz.addAvatar('vcc_female.cfg')

See also

<node3d:avatar>.forceAnimationLoad
<vizact>.onAsyncLoad
<viztask>.waitAsyncLoad
<node3d>.getAsyncStatus