FilamentInstance

FilamentInstance provides access to a hierarchy of entities instanced from a glTF asset.

Every entity has a TransformManager component. Some entities also have Name or Renderable components. Instances share material and geometry data with the parent FilamentAsset but maintain independent entity hierarchies, transforms, and animation states.

Key features:

  • Independent entity tree for each instance

  • Skeletal animation via getAnimator() (independent per-instance or shared from asset)

  • Material variant switching via applyMaterialVariant()

  • Skin/skeleton access for joint manipulation

  • Independent bounding box and transform root

Animation ownership: Each instance has its own Animator, but it can also be obtained from the parent FilamentAsset. Using the asset's animator means all instances share the same animation frame; using instance animators allows independent control.

See also

Constructors

Link copied to clipboard
constructor()

Create a new FilamentInstance.

constructor(nativeHandle: NativePointer)

Properties

Link copied to clipboard

Returns the animation engine for this instance.

Link copied to clipboard

Gets the FilamentAsset that owns this instance.

Link copied to clipboard

Gets the axis-aligned bounding box from the min/max values in the glTF accessors, transformed for this instance.

Link copied to clipboard

Gets the entities of this instance, one per glTF node. All have a Transform component; some also have a Renderable or Name component.

Link copied to clipboard

Gets the number of entities returned by entities.

Link copied to clipboard
Link copied to clipboard

Gets all material instances of this instance. These are already bound to renderables.

Link copied to clipboard

Gets the number of material variants declared in the asset.

Link copied to clipboard

The native object, for interop with code calling the Fila* C API directly. Read-only: this wrapper owns it.

Link copied to clipboard

Gets the transform root entity of this instance, which has no matching glTF node.

Link copied to clipboard

Gets the number of skins declared in the asset.

Functions

Link copied to clipboard
fun applyMaterialVariant(variantIndex: Int)

Applies the material variant at variantIndex to all primitives in this instance. Ignored if the index is out of bounds.

Link copied to clipboard
fun attachSkin(skinIndex: Int, target: Entity)

Attaches the given skin to the given node entity, which must have an associated mesh with BONE_INDICES and BONE_WEIGHTS attributes. No-op if the skin index or target is invalid.

Link copied to clipboard

Releases ownership of the material instances so they outlive the asset; the client destroys them.

Link copied to clipboard
fun detachSkin(skinIndex: Int, target: Entity)

Detaches the given skin from the given node entity. No-op if skin index or target is invalid.

Link copied to clipboard

Gets the inverse bind matrices of the skin at skinIndex: 16 column-major floats per joint.

Link copied to clipboard
fun getJointCountAt(skinIndex: Int): Int

Gets the number of joints in the skin at skinIndex.

Link copied to clipboard
fun getJointsAt(skinIndex: Int): IntArray

Gets the joint entities of the skin at skinIndex.

Link copied to clipboard
fun getMaterialVariantName(variantIndex: Int): String?

Gets the name of the material variant at variantIndex.

Link copied to clipboard
fun getSkinNameAt(skinIndex: Int): String?

Gets the name of the skin at skinIndex, or null if it has none.

Link copied to clipboard

Recomputes boundingBox from the current joint and morph state, for skinned or morphed meshes.