createObjectSound
Create a sound attached to an object.
Syntax
engine.audio.createObjectSound(object, soundName, options, withId);
Parameters
Name | Type | Description |
---|---|---|
object | string or ObjectManager | The object id or object manager to attach the sound to. |
soundName | string | The name of the sound to create. |
options | SoundOptions | The options to use for the sound. (optional) |
withId | string | The ID of the sound to create. (optional) |
Returns
SoundManager
- The sound manager.
Example
const audio = engine.audio.createObjectSound(object, 'fire', {
position: [0, 2, 0],
});
audio.play();
Available on: Client