Skip to main content

addAnimations

Adds animations to the engine.

Heads Up!

This method do not play animations to the player, it only adds it to the engine. To play animations to the player, use player.playAnimation.

Format

The animations file must be in the glTF format, and animations must be exported as NLA Actions (NLA Tracks).

You can use Blender to create animations and export them to the glTF format.

Syntax

engine.animations.addAnimations(url);

Parameters

NameTypeDescription
urlstringThe URL of the animation file to add.

Returns

  • Promise<AnimationInfo[]> - A promise that resolves to an array of AnimationInfo containing information about the animations that were added.

Example

const anims = await engine.animations.addAnimations(
'https://example.com/animation.glb',
);

console.log('Animations added:', anims);

Available on: Client