Skip to main content

createObjectSound

Create a sound attached to an object.

Syntax​

engine.audio.createObjectSound(object, soundName, options, withId);

Parameters​

NameTypeDescription
objectstring or ObjectManagerThe object id or object manager to attach the sound to.
soundNamestringThe name of the sound to create.
optionsSoundOptionsThe options to use for the sound. (optional)
withIdstringThe ID of the sound to create. (optional)

Returns​

Example​

const audio = engine.audio.createObjectSound(object, 'fire', {
position: [0, 2, 0],
});

audio.play();

Available on: Client