API

Getting Started - Chapter 3 - Character Animation

A Walking Figure

Sometimes the easiest way to add a model to a scene is to obtain one from elsewhere. This could be one you have created in your favorite model-building software or one you have purchased.

The Dude model is one that has been built with its own skeleton animation.

dude walking

Once imported, the character and its skeleton are obtained from the meshes and skeletons properties of the result object.

import { ImportMeshAsync } from "@babylonjs/core/Loading/sceneLoader";
import { Vector3 } from "@babylonjs/core/Maths/math.vector";
ImportMeshAsync("/scenes/Dude/Dude.babylon" /* model file */, scene, { meshNames: "him" }).then((result) => {
var dude = result.meshes[0];
dude.scaling = new Vector3(0.25, 0.25, 0.25);
scene.beginAnimation(result.skeletons[0], 0, 100, true, 1.0);
});
Loading an Animated Character

Currently, the character stands in one position, and we would like him to walk around the village. This time, instead of creating another animation object for the character, we will change its position and orientation before each frame is rendered.