The Live Characters plug-in allows you to animate Vizard avatars in real-time. The animation data is streamed from a Live Characters server directly to your script, and automatically applied to a specified avatar.
The interface for the Live Characters plug-in is located in the vizmocap module. Here is an example that connects to a Live Characters server on a remote machine and attaches an avatar to the data:
It is recommended that the Live Characters server run on a separate machine from the Vizard client. To connect to a Live Characters server on the local machine (e.g. testing purposes) set the in_port value to 8055:
Note: Translations and rotations of Live Characters are applied to the root bone of the avatar, and not the actual Vizard transform of the avatar. This means if the Live Character walks forward 1 meter, the position of the avatar will still be (0,0,0). If you want to know the position of the Live Character, you need to get the avatar's root bone position.
The Live Characters plug-in will print a warning if it does not receive a response from the server within a certain amount of time. The timeout for printing the warning is controlled with the LiveCharacter.connectionWarnTimeout option and the default value is 2 seconds. The plug-in will also attempt to reconnect to a server if it does not receive an update after the number of seconds specified with the LiveCharacter.connectionRetryTimeout option (default 2 seconds).
The following is a table of commands that are available on each LiveCharacter object:
LiveCharacter commands |
Description |
connect(server,port=8050,in_port=None) |
Connects to the LiveCharacter server at the specified IP address/hostname and port.
If in_port is specified, then incoming data will be transmitted on that port, otherwise it will be transmitted on server port. |
disconnect() |
Disconnects from the LiveCharacter server. |
addModel(model) |
Attaches the specified avatar to the LiveCharacter. |
removeModel(model) |
Detaches the specified avatar from the LiveCharacter. |
remove() |
Disconnects the LiveCharacter from the server and deletes the object. |
isConnected() |
Return whether the server has responded to clients connection request. |
getLastUpdateTime() |
Returns time of last update from server. Time is based on viz.tick() value. |
For convenience, the parameters to the connect and addModel commands can be specified in the constructor of the LiveCharacter object.