new babylonjs/HostObject(optionsopt)
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Options for the host. Properties
|
Extends
Members
(readonly) deltaTime :number
Gets the amount of time in milliseconds since update was last called.
Type:
- number
- Overrides:
(readonly) id :string
Gets the string id of the object.
Type:
- string
- Overrides:
(readonly) now :number
Gets the current time in milliseconds.
Type:
- number
- Overrides:
(readonly) owner :Object
Gets the engine owner object of the host.
Type:
- Object
- Overrides:
Methods
(static) addPointOfInterestTracking(host, scene, poiConfig, lookJointName)
Enable point of interest tracking on the host
Parameters:
Name | Type | Default | Description |
---|---|---|---|
host |
HostObject | ||
scene |
Scene | ||
poiConfig |
Object | ||
lookJointName |
string | char:jx_c_look | Default: 'char:jx_c_look' |
(static) addTextToSpeech(host, scene, voice, engine, language, audioJointName)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
host |
HostObject | ||
scene |
Scene | ||
voice |
string | ||
engine |
string | ||
language |
string | en-US | Default: 'en-US' |
audioJointName |
string | char:def_c_neckB | The identifier of the joint to attach the audio to. Default: 'char:def_c_neckB' |
(static) assembleHost(assets, scene)
Set up animations on a host - gestures, lipsync, etc - and start rendering them in the scene
Parameters:
Name | Type | Description |
---|---|---|
assets |
SumerianHostLoadedAssets | |
scene |
Scene |
(async, static) createHost(scene, characterConfig, pollyConfig, lookJoint) → {HostObject}
Creates a new Sumerian Host from the assets listed in the characterConfig
parameter. This can be used to create one of the built-in hosts or your own
custom host.
When creating a custom host, use HOST.HostObject.getCharacterConfig()
to
retrieve the appropriate config for that character. (See example below.)
Example:
const characterId = 'Cristine';
const characterConfig = HOST.HostUtils.getCharacterConfig('./assets/character-assets', characterId);
const pollyConfig = { pollyVoice: 'Joanna', pollyEngine: 'neural' };
const host = await HOST.HostUtils.createHost(scene, characterConfig, pollyConfig);
Parameters:
Name | Type | Description |
---|---|---|
scene |
Scene | The scene to add the host to. |
characterConfig |
SumerianCharacterConfig | |
pollyConfig |
SumerianPollyConfig | |
lookJoint |
string | The name of the joint to use for point-of-interest |
Returns:
A functioning Sumerian Host
- Type
- HostObject
(static) getAvailableCharacters() → {Array.<string>}
Returns:
An array of characterId's that can be used with getCharacterConfig
- Type
- Array.<string>
(static) getCharacterConfig(assetsPath, characterId) → {SumerianCharacterConfig}
Returns a config object describing the assets that comprise one of the
eight built-in Sumerian Host characters.
Available character IDs are:
- "Cristine"
- "Fiona"
- "Grace"
- "Maya"
- "Jay"
- "Luke"
- "Preston"
- "Wes"
Parameters:
Name | Type | Description |
---|---|---|
assetsPath |
string | A relative path from the HTML page to the directory containing the |
characterId |
string | The ID of the character to be used. |
Returns:
(async, static) initTextToSpeech(pollyopt, presigneropt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
polly |
AWS.Polly |
<optional> |
An AWS Polly service client, assumed to have the proper |
presigner |
AWS.Polly.presigner |
<optional> |
The presigner used for Polly calls |
(async, static) loadAnimation(scene, childMeshes, url, clipGroupId) → {Promise.<SumerianLoadedAnimation>}
Loads animations into the provided scene.
Parameters:
Name | Type | Description |
---|---|---|
scene |
Scene | |
childMeshes |
Array.<Mesh> | |
url |
string | URL of a 3D file containing animations (.gltf or .glb) |
clipGroupId |
string | An ID of your choosing for labeling the group. |
Returns:
- Type
- Promise.<SumerianLoadedAnimation>
(async, static) loadCharacterAnimations(scene, characterMesh, bindPoseOffset, animClipUrls) → {SumerianLoadedAnimations}
Loads the animations for a host character
Parameters:
Name | Type | Description |
---|---|---|
scene |
Scene | |
characterMesh |
Mesh | The root mesh of the character model |
bindPoseOffset |
AnimationGroup | |
animClipUrls |
SumerianAnimationsConfig |
Returns:
(async, static) loadCharacterMesh(scene, modelUrl) → {AssetContainer}
Loads the gltf file that comprises a character model,
and adds it to the scene to be rendered.
Parameters:
Name | Type | Description |
---|---|---|
scene |
Scene | |
modelUrl |
string | The absolute path to the gltf file that contains the model |
Returns:
A BabylonJS asset container that contains the loaded meshes
- Type
- AssetContainer
(async, static) loadJson(url)
Reads JSON file
Parameters:
Name | Type | Description |
---|---|---|
url |
string |
Returns:
JSON from file
addFeature(FeatureClass, forceopt, …args) → {boolean}
Instantiate a new Host feature and store it. Features must inherit from
AbstractHostFeature.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
FeatureClass |
Class | Class that will instantiate the feature. Must |
||
force |
boolean |
<optional> |
false | Whether or not to overwrite an existing |
args |
any |
<repeatable> |
Additional arguments to pass to the FeatureClass |
- Overrides:
Returns:
- Whether or not a feature was successfully added.
- Type
- boolean
emit(message, valueopt)
Send a message, causing listener functions for the message on this object
to be executed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
string | The message to emit. |
|
value |
any |
<optional> |
Optional argument to pass to listener callbacks. |
- Overrides:
hasFeature(typeName) → {boolean}
Indicate whether a specified feature is installed on the host.
Parameters:
Name | Type | Description |
---|---|---|
typeName |
string | Name of the type of feature to look for. |
- Overrides:
Returns:
- Type
- boolean
listenTo(message, callback)
Execute a function when a message is received for this object.
Parameters:
Name | Type | Description |
---|---|---|
message |
string | The message to listen for. |
callback |
function | Function to execute once the message is received. |
- Overrides:
listFeatures() → {Array.<string>}
List the names of the features installed on the host.
- Overrides:
Returns:
- Type
- Array.<string>
removeFeature(typeName) → {boolean}
Remove a feature from the object.
Parameters:
Name | Type | Description |
---|---|---|
typeName |
string | Name of the type of feature to remove. |
- Overrides:
Returns:
- Whether or not a feature was successfully removed.
- Type
- boolean
stopListening(message, callbackopt)
Prevent a function from being executed when a message is received for this
object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
string | The message to stop listening for. |
|
callback |
function |
<optional> |
Optional callback to remove. If none is defined, |
- Overrides:
stopListeningByRegexp(regexp, callbackopt)
De-register callback(s) from being executed when messages matching the given
regular expression are received.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
regexp |
Regexp | regexp - The regular expression to filter messages with. |
|
callback |
function |
<optional> |
Optional callback to remove. If none is defined, |
- Overrides:
stopListeningToAll()
Prevent any functions from being executed when any message is received for
this object.
- Overrides:
update()
This function should be called in the engine's render loop. Executes update
loops for all features.
- Overrides:
wait(secondsopt, optionsopt) → {Deferred}
Return a deferred promise that will wait a given number of seconds before
resolving. The host will continuously update the wait promise during the
update loop until it resolves.
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
seconds |
number |
<optional> |
0 | Number of seconds to wait before resolving. |
||||||||||||||||||||
options |
Object |
<optional> |
Optional options object Properties
|
- Overrides:
Returns:
- Type
- Deferred