API

Class AssetContainer

Container with a set of assets that can be added or removed from a scene.

Hierarchy (View Summary)

Index
actionManagers: AbstractActionManager[] = []

ActionManagers available on the scene.

animationGroups: AnimationGroup[] = []

All of the animation groups added to this scene

animations: Animation[] = []

Gets a list of Animations associated with the scene

cameras: Camera[] = []

All of the cameras added to this scene

effectLayers: EffectLayer[] = []

The list of effect layers added to the scene

geometries: Geometry[] = []

The list of geometries used in the scene.

layers: Layer[] = []

The list of layers added to the scene

lensFlareSystems: LensFlareSystem[]

The list of lens flare systems added to the scene

lights: Light[] = []

All of the lights added to this scene

materials: Material[] = []

All of the materials added to this scene In the context of a Scene, it is not supposed to be modified manually. Any addition or removal should be done using the addMaterial and removeMaterial Scene methods. Note also that the order of the Material within the array is not significant and might change.

meshes: AbstractMesh[] = []

All of the (abstract) meshes added to this scene

morphTargetManagers: MorphTargetManager[] = []

The list of morph target managers added to the scene

multiMaterials: MultiMaterial[] = []

All of the multi-materials added to this scene

particleSystems: IParticleSystem[] = []

All of the particle systems added to this scene

postProcesses: PostProcess[] = []

The list of postprocesses added to the scene

proceduralTextures: ProceduralTexture[]

The list of procedural textures added to the scene

reflectionProbes: ReflectionProbe[] = []

The list of reflection probes added to the scene

rootNodes: Node[] = []

Gets the list of root nodes (ie. nodes with no parent)

scene: Scene

The scene the AssetContainer belongs to.

skeletons: Skeleton[] = []

The list of skeletons added to the scene

sounds: Nullable<Sound[]> = null

The list of sounds

spriteManagers: SpriteManager[] = []

The list of sprite managers added to the scene

textures: BaseTexture[] = []

Textures to keep.

transformNodes: TransformNode[] = []

All of the transform nodes added to this scene In the context of a Scene, it is not supposed to be modified manually. Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods. Note also that the order of the TransformNode within the array is not significant and might change.

  • get environmentTexture(): Nullable<BaseTexture>

    Texture used in all pbr material as the reflection texture. As in the majority of the scene they are the same (exception for multi room and so on), this is easier to reference from here than from all the materials.

    Returns Nullable<BaseTexture>

  • set environmentTexture(value: Nullable<BaseTexture>): void

    Texture used in all pbr material as the reflection texture. As in the majority of the scene they are the same (exception for multi room and so on), this is easier to reference from here than from all the materials.

    Parameters

    Returns void

  • Since

    6.26.0 Given a root asset, this method will traverse its hierarchy and add it, its children and any materials/skeletons to the container.

    Parameters

    • root: Node

      root node

    Returns void

  • Adds assets from the container to the scene.

    Parameters

    • predicate: Nullable<(entity: any) => boolean> = null

      defines a predicate used to select which entity will be added (can be null)

    Returns void

  • Adds all meshes in the asset container to a root mesh that can be used to position all the contained meshes. The root mesh is then added to the front of the meshes in the assetContainer.

    Returns Mesh

    the root mesh

  • Get a list of cameras by tags

    Parameters

    • tagsQuery: string

      defines the tags query to use

    • Optionalfilter: (camera: Camera) => boolean

      defines a predicate used to filter results

    Returns Camera[]

    an array of Camera

  • Get a list of lights by tags

    Parameters

    • tagsQuery: string

      defines the tags query to use

    • Optionalfilter: (light: Light) => boolean

      defines a predicate used to filter results

    Returns Light[]

    an array of Light

  • Get a list of materials by tags

    Parameters

    • tagsQuery: string

      defines the tags query to use

    • Optionalfilter: (material: Material) => boolean

      defines a predicate used to filter results

    Returns Material[]

    an array of Material

  • Instantiate or clone all meshes and add the new ones to the scene. Skeletons and animation groups will all be cloned

    Parameters

    • OptionalnameFunction: (sourceName: string) => string

      defines an optional function used to get new names for clones

    • cloneMaterials: boolean = false

      defines an optional boolean that defines if materials must be cloned as well (false by default)

    • Optionaloptions: {
          doNotInstantiate?: boolean | ((node: Node) => boolean);
          predicate?: (entity: any) => boolean;
      }

      defines an optional list of options to control how to instantiate / clone models

      • OptionaldoNotInstantiate?: boolean | ((node: Node) => boolean)

        defines if the model must be instantiated or just cloned

      • Optionalpredicate?: (entity: any) => boolean

        defines a predicate used to filter whih mesh to instantiate/clone

    Returns InstantiatedEntries

    a list of rootNodes, skeletons and animation groups that were duplicated

  • Merge animations (direct and animation groups) from this asset container into a scene

    Parameters

    • scene: Nullable<Scene> = EngineStore.LastCreatedScene

      is the instance of BABYLON.Scene to append to (default: last created scene)

    • animatables: Animatable[]

      set of animatables to retarget to a node from the scene

    • targetConverter: Nullable<(target: any) => Nullable<Node>> = null

      defines a function used to convert animation targets from the asset container to the scene (default: search node by name)

    Returns AnimationGroup[]

    an array of the new AnimationGroup added to the scene (empty array if none)

  • Since

    6.15.0 This method checks for any node that has no parent and is not in the rootNodes array, and adds the node there, if so.

    Returns void

  • Removes assets in the container from the scene

    Parameters

    • predicate: Nullable<(entity: any) => boolean> = null

      defines a predicate used to select which entity will be added (can be null)

    Returns void