Skip to content

Skinning

Instances can play skeletal animations, each with its own pose.

iMesh.initSkeleton(skeleton);
for (const instance of iMesh.instances) {
mixer.setTime(instance.time);
instance.updateBones();
}

initSkeleton disables the automatic matrix update of the bones (they are updated per instance), improving performance.

Only Visible Instances

To animate only the instances inside the camera frustum, use the onFrustumEnter callback:

iMesh.onFrustumEnter = (index) => {
iMesh.instances[index].updateBones();
return true;
};