Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a scene to be rendered by the engine.

see

https://doc.babylonjs.com/features/featuresDeepDive/scene

Hierarchy

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

  • Creates a new Scene

    Parameters

    • engine: Engine

      defines the engine to use to render this scene

    • Optional options: SceneOptions

      defines the scene options

    Returns Scene

Properties

_afterRenderTargetPostProcessStage: Stage<RenderTargetStageAction>

Defines the actions happening just after the post processing on a render target

actionManager: AbstractActionManager

Gets or sets the action manager associated with the scene

see

https://doc.babylonjs.com/features/featuresDeepDive/events/actions

actionManagers: AbstractActionManager[]

ActionManagers available on the scene.

deprecated
ambientColor: Color3

Defines the color used to simulate the ambient color (Default is (0, 0, 0))

animationGroups: AnimationGroup[]

All of the animation groups added to this scene

see

https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations

animationTimeScale: number

Gets or sets a general scale for animation speed

see

https://www.babylonjs-playground.com/#IBU2W7#3

animations: Animation[]

Gets a list of Animations associated with the scene

animationsEnabled: boolean

Gets or sets a boolean indicating if animations are enabled

audioEnabled: boolean
audioListenerPositionProvider: Nullable<(() => Vector3)>

Gets or sets custom audio listener position provider

see

https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic

audioListenerRotationProvider: Nullable<(() => Vector3)>

Gets or sets custom audio listener rotation provider

see

https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic

audioPositioningRefreshRate: number

Gets or sets a refresh rate when using 3D audio positioning

autoClear: boolean

Gets or sets a boolean that indicates if the scene must clear the render buffer before rendering a frame

autoClearDepthAndStencil: boolean

Gets or sets a boolean that indicates if the scene must clear the depth and stencil buffers before rendering a frame

cameraToUseForPointers: Nullable<Camera>

Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position

cameras: Camera[]

All of the cameras added to this scene

see

https://doc.babylonjs.com/features/featuresDeepDive/cameras

clearColor: Color4

Defines the color used to clear the render buffer (Default is (0.2, 0.2, 0.3, 1.0))

clipPlane: Nullable<Plane>

Gets or sets the active clipplane 1

clipPlane2: Nullable<Plane>

Gets or sets the active clipplane 2

clipPlane3: Nullable<Plane>

Gets or sets the active clipplane 3

clipPlane4: Nullable<Plane>

Gets or sets the active clipplane 4

clipPlane5: Nullable<Plane>

Gets or sets the active clipplane 5

clipPlane6: Nullable<Plane>

Gets or sets the active clipplane 6

collisionsEnabled: boolean

Gets or sets a boolean indicating if collisions are enabled on this scene

see

https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions

constantlyUpdateMeshUnderPointer: boolean

Gets or sets a boolean indicating if the scene must keep the meshUnderPointer property updated Please note that it requires to run a ray cast through the scene on every frame

customLODSelector: ((mesh: AbstractMesh, camera: Camera) => Nullable<AbstractMesh>)

Type declaration

customRenderTargets: RenderTargetTexture[]

The list of user defined render targets added to the scene

debugLayer: DebugLayer

Gets the debug layer (aka Inspector) associated with the scene

see

https://doc.babylonjs.com/toolsAndResources/inspector

defaultCursor: string

Defines the HTML default cursor to use (empty by default)

deltaTime: number

Gets the current delta time used by animation engine

depthPeelingRenderer: Nullable<DepthPeelingRenderer>

The depth peeling renderer

disableOfflineSupportExceptionRules: RegExp[]

Use this array to add regular expressions used to disable offline support for specific urls

dispatchAllSubMeshesOfActiveMeshes: boolean

Gets or sets a boolean indicating that all submeshes of active meshes must be rendered Use this boolean to avoid computing frustum clipping on submeshes (This could help when you are CPU bound)

doNotHandleCursors: boolean

Defines whether cursors are handled by the scene.

dumpNextRenderTargets: boolean

Gets or sets a boolean indicating if next render targets must be dumped as image for debugging purposes We recommend not using it and instead rely on Spector.js: http://spector.babylonjs.com

effectLayers: EffectLayer[]
environmentBRDFTexture: BaseTexture

This is use to store the default BRDF lookup for PBR materials in your scene. It should only be one of the following (if not the default embedded one):

environmentIntensity: number

Intensity of the environment in all pbr material. This dims or reinforces the IBL lighting overall (reflection and diffuse). 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.

fluidRenderer: Nullable<FluidRenderer>

Gets or Sets the fluid renderer associated to the scene.

fogColor: Color3

Gets or sets the fog color to use

see

https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog (Default is Color3(0.2, 0.2, 0.3))

fogDensity: number
fogEnd: number

Gets or sets the fog end distance to use

see

https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog (Default is 1000)

fogStart: number

Gets or sets the fog start distance to use

see

https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog (Default is 0)

forceShowBoundingBoxes: boolean

Gets or sets a boolean indicating if all bounding boxes must be rendered

gamepadManager: GamepadManager

Gets the gamepad manager associated with the scene

see

https://doc.babylonjs.com/features/featuresDeepDive/input/gamepads

geometries: Geometry[]

The list of geometries used in the scene.

geometryBufferRenderer: Nullable<GeometryBufferRenderer>

Gets or Sets the current geometry buffer associated to the scene.

getActiveMeshCandidates: (() => ISmartArrayLike<AbstractMesh>)

Type declaration

getActiveSubMeshCandidates: ((mesh: AbstractMesh) => ISmartArrayLike<SubMesh>)

Type declaration

getCollidingSubMeshCandidates: ((mesh: AbstractMesh, collider: Collider) => ISmartArrayLike<SubMesh>)

Type declaration

getDeterministicFrameTime: (() => number)

Type declaration

    • (): number
    • User updatable function that will return a deterministic frame time when engine is in deterministic lock step mode

      Returns number

getIntersectingSubMeshCandidates: ((mesh: AbstractMesh, localRay: Ray) => ISmartArrayLike<SubMesh>)

Type declaration

gravity: Vector3

Defines the gravity applied to this scene (used only for collisions)

see

https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions

headphone: boolean

Gets or sets if audio will be output to headphones

see

https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic

hoverCursor: string

Defines the HTML cursor to use when hovering over interactive elements

importedMeshesFiles: string[]

Gets the list of meshes imported to the scene through SceneLoader

layers: Layer[]

The list of layers (background and foreground) of the scene

lensFlareSystems: LensFlareSystem[]

The list of lens flare system added to the scene

see

https://doc.babylonjs.com/features/featuresDeepDive/environment/lenseFlare

lensFlaresEnabled: boolean

Gets or sets a boolean indicating if lens flares are enabled on this scene

lights: Light[]
loadingPluginName: string

Gets the name of the plugin used to load this scene (null by default)

mainSoundTrack: SoundTrack

The main sound track played by the scene. It contains your primary collection of sounds.

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.

see

https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction

meshes: AbstractMesh[]

All of the (abstract) meshes added to this scene

metadata: any

Gets or sets user defined metadata

morphTargetManagers: MorphTargetManager[]

The list of morph target managers added to the scene

see

https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph

multiMaterials: MultiMaterial[]
needsPreviousWorldMatrices: boolean

Flag indicating if we need to store previous matrices when rendering

offlineProvider: IOfflineProvider

Gets or sets the current offline provider to use to store scene data

see

https://doc.babylonjs.com/features/featuresDeepDive/scene/optimizeCached

onActiveCameraChanged: Observable<Scene>

An event triggered when the activeCamera property is updated

onActiveCamerasChanged: Observable<Scene>

An event triggered when the activeCameras property is updated

onAfterActiveMeshesEvaluationObservable: Observable<Scene>

An event triggered when active meshes evaluation is done

onAfterAnimationsObservable: Observable<Scene>

An event triggered after animations processing

onAfterCameraRenderObservable: Observable<Camera>

An event triggered after rendering a camera This is triggered for the full rig Camera only unlike onAfterRenderCameraObservable

onAfterDrawPhaseObservable: Observable<Scene>

An event triggered after draw calls have been sent

onAfterParticlesRenderingObservable: Observable<Scene>

An event triggered when particles rendering is done Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)

onAfterPhysicsObservable: Observable<Scene>

An event triggered when physic simulation has been done

onAfterRenderCameraObservable: Observable<Camera>

An event triggered after rendering the scene for an active camera (When scene.render is called this will be called after each camera) This is triggered for each "sub" camera in a Camera Rig unlike onAfterCameraRenderObservable

onAfterRenderObservable: Observable<Scene>

An event triggered after rendering the scene

onAfterRenderTargetsRenderObservable: Observable<Scene>

An event triggered when render targets were rendered. Can happen multiple times per frame.

onAfterRenderingGroupObservable: Observable<RenderingGroupInfo>

This Observable will be triggered after rendering each renderingGroup of each rendered camera. The RenderingGroupInfo class contains all the information about the context in which the observable is called If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3)

onAfterSpritesRenderingObservable: Observable<Scene>

An event triggered when sprites rendering is done Note: This event can be trigger more than once per frame (because sprites can be rendered by render target textures as well)

onAfterStepObservable: Observable<Scene>

An event triggered after calculating deterministic simulation step

onAnimationFileImportedObservable: Observable<Scene>

This Observable will when an animation file has been imported into the scene.

onBeforeActiveMeshesEvaluationObservable: Observable<Scene>

An event triggered when active meshes evaluation is about to start

onBeforeAnimationsObservable: Observable<Scene>

An event triggered before animating the scene

onBeforeCameraRenderObservable: Observable<Camera>

An event triggered before rendering a camera

onBeforeDrawPhaseObservable: Observable<Scene>

An event triggered before draw calls are ready to be sent

onBeforeParticlesRenderingObservable: Observable<Scene>

An event triggered when particles rendering is about to start Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)

onBeforePhysicsObservable: Observable<Scene>

An event triggered when physic simulation is about to be run

onBeforeRenderObservable: Observable<Scene>

An event triggered before rendering the scene (right after animations and physics)

onBeforeRenderTargetsRenderObservable: Observable<Scene>

An event triggered when render targets are about to be rendered Can happen multiple times per frame.

onBeforeRenderingGroupObservable: Observable<RenderingGroupInfo>

This Observable will be triggered before rendering each renderingGroup of each rendered camera. The RenderingGroupInfo class contains all the information about the context in which the observable is called If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3)

onBeforeSpritesRenderingObservable: Observable<Scene>

An event triggered when sprites rendering is about to start Note: This event can be trigger more than once per frame (because sprites can be rendered by render target textures as well)

onBeforeStepObservable: Observable<Scene>

An event triggered before calculating deterministic simulation step

onCameraRemovedObservable: Observable<Camera>

An event triggered when a camera is removed

onDataLoadedObservable: Observable<Scene>

An event triggered when SceneLoader.Append or SceneLoader.Load or SceneLoader.ImportMesh were successfully executed

onDisposeObservable: Observable<Scene>

An event triggered when the scene is disposed.

onGeometryRemovedObservable: Observable<Geometry>

An event triggered when a geometry is removed

onKeyboardObservable: Observable<KeyboardInfo>

Observable event triggered each time an keyboard event is received from the hosting window

onLightRemovedObservable: Observable<Light>

An event triggered when a light is removed

onMaterialRemovedObservable: Observable<Material>

An event triggered when a material is removed

onMeshImportedObservable: Observable<AbstractMesh>

This Observable will when a mesh has been imported into the scene.

onMeshRemovedObservable: Observable<AbstractMesh>

An event triggered when a mesh is removed

onMultiMaterialRemovedObservable: Observable<MultiMaterial>

An event triggered when a multi material is removed

onNewCameraAddedObservable: Observable<Camera>

An event triggered when a camera is created

onNewGeometryAddedObservable: Observable<Geometry>

An event triggered when a geometry is created

onNewLightAddedObservable: Observable<Light>

An event triggered when a light is created

onNewMaterialAddedObservable: Observable<Material>

An event triggered when a material is created

onNewMeshAddedObservable: Observable<AbstractMesh>

An event triggered when a mesh is created

onNewMultiMaterialAddedObservable: Observable<MultiMaterial>

An event triggered when a multi material is created

onNewSkeletonAddedObservable: Observable<Skeleton>

An event triggered when a skeleton is created

onNewTextureAddedObservable: Observable<BaseTexture>

An event triggered when a texture is created

onNewTransformNodeAddedObservable: Observable<TransformNode>

An event triggered when a transform node is created

onPointerDown?: ((evt: IPointerEvent, pickInfo: PickingInfo, type: PointerEventTypes) => void)

Type declaration

onPointerMove?: ((evt: IPointerEvent, pickInfo: PickingInfo, type: PointerEventTypes) => void)

Type declaration

onPointerObservable: Observable<PointerInfo>

Observable event triggered each time an input event is received from the rendering canvas

onPointerPick?: ((evt: IPointerEvent, pickInfo: PickingInfo) => void)

Type declaration

onPointerUp?: ((evt: IPointerEvent, pickInfo: Nullable<PickingInfo>, type: PointerEventTypes) => void)

Type declaration

onPreKeyboardObservable: Observable<KeyboardInfoPre>

This observable event is triggered when any keyboard event si raised and registered during Scene.attachControl() You have the possibility to skip the process and the call to onKeyboardObservable by setting KeyboardInfoPre.skipOnPointerObservable to true

onPrePointerObservable: Observable<PointerInfoPre>

This observable event is triggered when any ponter event is triggered. It is registered during Scene.attachControl() and it is called BEFORE the 3D engine process anything (mesh/sprite picking for instance). You have the possibility to skip the process and the call to onPointerObservable by setting PointerInfoPre.skipOnPointerObservable to true

onReadyObservable: Observable<Scene>

An event triggered when the scene is ready

onScenePerformancePriorityChangedObservable: Observable<ScenePerformancePriority>

Observable triggered when the performance priority is changed

onSkeletonRemovedObservable: Observable<Skeleton>

An event triggered when a skeleton is removed

onTextureRemovedObservable: Observable<BaseTexture>

An event triggered when a texture is removed

onTransformNodeRemovedObservable: Observable<TransformNode>

An event triggered when a transform node is removed

particleSystems: IParticleSystem[]
particlesEnabled: boolean

Gets or sets a boolean indicating if particles are enabled on this scene

physicsEnabled: boolean

Gets or sets a boolean indicating if physic engines are enabled on this scene

pointerMoveTrianglePredicate: undefined | ((p0: Vector3, p1: Vector3, p2: Vector3, ray: Ray) => boolean)

Gets or sets a predicate used to select candidate faces for a pointer move event

postProcessManager: PostProcessManager

Gets the current postprocess manager

postProcessRenderPipelineManager: PostProcessRenderPipelineManager
postProcesses: PostProcess[]

The list of postprocesses added to the scene

postProcessesEnabled: boolean

Gets or sets a boolean indicating if postprocesses are enabled on this scene

prePassRenderer: Nullable<PrePassRenderer>

Gets or Sets the current prepass renderer associated to the scene.

preventDefaultOnPointerDown: boolean

This is used to call preventDefault() on pointer down in order to block unwanted artifacts like system double clicks

preventDefaultOnPointerUp: boolean

This is used to call preventDefault() on pointer up in order to block unwanted artifacts like system double clicks

probesEnabled: boolean

Gets or sets a boolean indicating if probes are enabled on this scene

proceduralTextures: ProceduralTexture[]
proceduralTexturesEnabled: boolean

Gets or sets a boolean indicating if procedural textures are enabled on this scene

reflectionProbes: ReflectionProbe[]

The list of reflection probes added to the scene

see

https://doc.babylonjs.com/features/featuresDeepDive/environment/reflectionProbes

renderTargetsEnabled: boolean

Gets or sets a boolean indicating if render targets are enabled on this scene

requireLightSorting: boolean

Gets or sets a boolean indicating if lights must be sorted by priority (off by default) This is useful if there are more lights that the maximum simulteanous authorized

reservedDataStore: any

For internal use only. Please do not use.

rootNodes: Node[]

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

selectionOctree: Octree<AbstractMesh>

Gets the octree used to boost mesh selection (picking)

see

https://doc.babylonjs.com/features/featuresDeepDive/scene/optimizeOctrees

simplificationQueue: SimplificationQueue

Gets or sets the simplification queue attached to the scene

see

https://doc.babylonjs.com/features/featuresDeepDive/mesh/simplifyingMeshes

skeletons: Skeleton[]
soundTracks: Nullable<SoundTrack[]>
sounds: Nullable<Sound[]>

The list of sounds used in the scene.

spriteManagers?: ISpriteManager[]

All of the sprite managers added to this scene

see

https://doc.babylonjs.com/features/featuresDeepDive/sprites

spritesEnabled: boolean

Gets or sets a boolean indicating if sprites are enabled on this scene

subSurfaceConfiguration: Nullable<SubSurfaceConfiguration>

Gets or Sets the current prepass renderer associated 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.

see

https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node

useConstantAnimationDeltaTime: boolean

Gets or sets a boolean indicating if a constant deltatime has to be used This is mostly useful for testing purposes when you do not want the animations to scale with the framerate

useDelayedTextureLoading: boolean

Defines if texture loading must be delayed If true, textures will only be loaded when they need to be rendered

useOrderIndependentTransparency: boolean

Flag to indicate if we want to use order independent transparency, despite the performance hit

FOGMODE_EXP: 1 = 1

The fog density is following an exponential function

FOGMODE_EXP2: 2 = 2

The fog density is following an exponential function faster than FOGMODE_EXP

FOGMODE_LINEAR: 3 = 3

The fog density is following a linear function.

FOGMODE_NONE: 0 = 0

The fog is deactivated

MaxDeltaTime: number

Gets or sets the maximum deltatime when deterministic lock step is enabled

see

https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep

MinDeltaTime: number

Gets or sets the minimum deltatime when deterministic lock step is enabled

see

https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep

Accessors

  • Gets or sets the current active camera

    Returns Nullable<Camera>

  • Gets or sets the current active camera

    Parameters

    Returns void

  • All of the active cameras added to this scene.

    Returns Nullable<Camera[]>

  • All of the active cameras added to this scene.

    Parameters

    Returns void

  • set afterCameraRender(callback: (() => void)): void
  • Sets a function to be executed after rendering a camera

    Parameters

    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • set afterRender(callback: Nullable<(() => void)>): void
  • Sets a function to be executed after rendering this scene

    Parameters

    Returns void

  • Gets all animatable attached to the scene

    Returns Animatable[]

  • set beforeCameraRender(callback: (() => void)): void
  • Sets a function to be executed before rendering a camera

    Parameters

    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • set beforeRender(callback: Nullable<(() => void)>): void
  • Sets a function to be executed before rendering this scene

    Parameters

    Returns void

  • get blockMaterialDirtyMechanism(): boolean
  • set blockMaterialDirtyMechanism(value: boolean): void
  • Gets or sets a boolean blocking all the calls to markAllMaterialsAsDirty (ie. the materials won't be updated if they are out of sync)

    Returns boolean

  • Gets or sets a boolean blocking all the calls to markAllMaterialsAsDirty (ie. the materials won't be updated if they are out of sync)

    Parameters

    • value: boolean

    Returns void

  • get blockfreeActiveMeshesAndRenderingGroups(): boolean
  • set blockfreeActiveMeshesAndRenderingGroups(value: boolean): void
  • Gets or sets a boolean blocking all the calls to freeActiveMeshes and freeRenderingGroups It can be used in order to prevent going through methods freeRenderingGroups and freeActiveMeshes several times to improve performance when disposing several meshes in a row or a hierarchy of meshes. When used, it is the responsibility of the user to blockfreeActiveMeshesAndRenderingGroups back to false.

    Returns boolean

  • Gets or sets a boolean blocking all the calls to freeActiveMeshes and freeRenderingGroups It can be used in order to prevent going through methods freeRenderingGroups and freeActiveMeshes several times to improve performance when disposing several meshes in a row or a hierarchy of meshes. When used, it is the responsibility of the user to blockfreeActiveMeshesAndRenderingGroups back to false.

    Parameters

    • value: boolean

    Returns void

  • The default material used on meshes when no material is affected

    Returns Material

  • The default material used on meshes when no material is affected

    Parameters

    Returns 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.

    Returns 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 set here than in all the materials.

    Parameters

    Returns void

  • get fogEnabled(): boolean
  • set fogEnabled(value: boolean): void
  • get fogMode(): number
  • set fogMode(value: number): void
  • get forcePointsCloud(): boolean
  • set forcePointsCloud(value: boolean): void
  • Gets or sets a boolean indicating if all rendering must be done in point cloud

    Returns boolean

  • Gets or sets a boolean indicating if all rendering must be done in point cloud

    Parameters

    • value: boolean

    Returns void

  • get forceWireframe(): boolean
  • set forceWireframe(value: boolean): void
  • Gets or sets a boolean indicating if all rendering must be done in wireframe

    Returns boolean

  • Gets or sets a boolean indicating if all rendering must be done in wireframe

    Parameters

    • value: boolean

    Returns void

  • get frustumPlanes(): Plane[]
  • Gets the list of frustum planes (built from the active camera)

    Returns Plane[]

  • Default image processing configuration used either in the rendering Forward main pass or through the imageProcessingPostProcess if present. As in the majority of the scene they are the same (exception for multi camera), this is easier to reference from here than from all the materials and post process.

    No setter as we it is a shared configuration, you can set the values instead.

    Returns ImageProcessingConfiguration

  • get isDisposed(): boolean
  • Gets if the scene is already disposed

    Returns boolean

  • get isLoading(): boolean
  • Returns a boolean indicating if the scene is still loading data

    Returns boolean

  • get lightsEnabled(): boolean
  • set lightsEnabled(value: boolean): void
  • Gets or sets a boolean indicating if lights are enabled on this scene

    Returns boolean

  • Gets or sets a boolean indicating if lights are enabled on this scene

    Parameters

    • value: boolean

    Returns void

  • Gets the mesh that is currently under the pointer

    Returns Nullable<AbstractMesh>

  • set onDispose(callback: (() => void)): void
  • Sets a function to be executed when this scene is disposed.

    Parameters

    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Gets or sets a value indicating how to treat performance relatively to ease of use and backward compatibility

    Returns ScenePerformancePriority

  • Gets or sets a value indicating how to treat performance relatively to ease of use and backward compatibility

    Parameters

    Returns void

  • get pointerDownFastCheck(): boolean
  • set pointerDownFastCheck(value: boolean): void
  • Gets or sets a predicate used to select candidate meshes for a pointer down event

    Returns boolean

  • Gets or sets a predicate used to select candidate meshes for a pointer down event

    Parameters

    • value: boolean

    Returns void

  • get pointerDownPredicate(): ((Mesh: AbstractMesh) => boolean)
  • set pointerDownPredicate(value: ((Mesh: AbstractMesh) => boolean)): void
  • Gets or sets a predicate used to select candidate meshes for a pointer down event

    Returns ((Mesh: AbstractMesh) => boolean)

      • Gets or sets a predicate used to select candidate meshes for a pointer down event

        Parameters

        Returns boolean

  • Gets or sets a predicate used to select candidate meshes for a pointer down event

    Parameters

    Returns void

  • get pointerMoveFastCheck(): boolean
  • set pointerMoveFastCheck(value: boolean): void
  • Gets or sets a predicate used to select candidate meshes for a pointer move event

    Returns boolean

  • Gets or sets a predicate used to select candidate meshes for a pointer move event

    Parameters

    • value: boolean

    Returns void

  • get pointerMovePredicate(): ((Mesh: AbstractMesh) => boolean)
  • set pointerMovePredicate(value: ((Mesh: AbstractMesh) => boolean)): void
  • Gets or sets a predicate used to select candidate meshes for a pointer move event

    Returns ((Mesh: AbstractMesh) => boolean)

      • Gets or sets a predicate used to select candidate meshes for a pointer move event

        Parameters

        Returns boolean

  • Gets or sets a predicate used to select candidate meshes for a pointer move event

    Parameters

    Returns void

  • get pointerUpFastCheck(): boolean
  • set pointerUpFastCheck(value: boolean): void
  • Gets or sets a predicate used to select candidate meshes for a pointer up event

    Returns boolean

  • Gets or sets a predicate used to select candidate meshes for a pointer up event

    Parameters

    • value: boolean

    Returns void

  • get pointerUpPredicate(): ((Mesh: AbstractMesh) => boolean)
  • set pointerUpPredicate(value: ((Mesh: AbstractMesh) => boolean)): void
  • Gets or sets a predicate used to select candidate meshes for a pointer up event

    Returns ((Mesh: AbstractMesh) => boolean)

      • Gets or sets a predicate used to select candidate meshes for a pointer up event

        Parameters

        Returns boolean

  • Gets or sets a predicate used to select candidate meshes for a pointer up event

    Parameters

    Returns void

  • get pointerX(): number
  • set pointerX(value: number): void
  • Gets or sets the current on-screen X position of the pointer

    Returns number

  • Gets or sets the current on-screen X position of the pointer

    Parameters

    • value: number

    Returns void

  • get pointerY(): number
  • set pointerY(value: number): void
  • Gets or sets the current on-screen Y position of the pointer

    Returns number

  • Gets or sets the current on-screen Y position of the pointer

    Parameters

    • value: number

    Returns void

  • get prePass(): boolean
  • Flag indicating that the frame buffer binding is handled by another component

    Returns boolean

  • Gets the scene's rendering manager

    Returns RenderingManager

  • get shadowsEnabled(): boolean
  • set shadowsEnabled(value: boolean): void
  • Gets or sets a boolean indicating if shadows are enabled on this scene

    Returns boolean

  • Gets or sets a boolean indicating if shadows are enabled on this scene

    Parameters

    • value: boolean

    Returns void

  • get skeletonsEnabled(): boolean
  • set skeletonsEnabled(value: boolean): void
  • Gets or sets a boolean indicating if skeletons are enabled on this scene

    Returns boolean

  • Gets or sets a boolean indicating if skeletons are enabled on this scene

    Parameters

    • value: boolean

    Returns void

  • get skipFrustumClipping(): boolean
  • set skipFrustumClipping(value: boolean): void
  • Gets or sets a boolean indicating if we should skip the frustum clipping part of the active meshes selection

    Returns boolean

  • Gets or sets a boolean indicating if we should skip the frustum clipping part of the active meshes selection

    Parameters

    • value: boolean

    Returns void

  • get skipPointerDownPicking(): boolean
  • set skipPointerDownPicking(value: boolean): void
  • Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer down event occurs.

    Returns boolean

  • Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer down event occurs.

    Parameters

    • value: boolean

    Returns void

  • get skipPointerMovePicking(): boolean
  • set skipPointerMovePicking(value: boolean): void
  • Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer move event occurs.

    Returns boolean

  • Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer move event occurs.

    Parameters

    • value: boolean

    Returns void

  • get skipPointerUpPicking(): boolean
  • set skipPointerUpPicking(value: boolean): void
  • Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer up event occurs. Off by default.

    Returns boolean

  • Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer up event occurs. Off by default.

    Parameters

    • value: boolean

    Returns void

  • get texturesEnabled(): boolean
  • set texturesEnabled(value: boolean): void
  • Gets or sets a boolean indicating if textures are enabled on this scene

    Returns boolean

  • Gets or sets a boolean indicating if textures are enabled on this scene

    Parameters

    • value: boolean

    Returns void

  • get uid(): string
  • Return a unique id as a string which can serve as an identifier for the scene

    Returns string

  • Gets the pointer coordinates without any translation (ie. straight out of the pointer event)

    Returns Vector2

  • get useRightHandedSystem(): boolean
  • set useRightHandedSystem(value: boolean): void
  • Gets or sets a boolean indicating if the scene must use right-handed coordinates system

    Returns boolean

  • Gets or sets a boolean indicating if the scene must use right-handed coordinates system

    Parameters

    • value: boolean

    Returns void

  • get DoubleClickDelay(): number
  • set DoubleClickDelay(value: number): void
  • Time in milliseconds to wait to raise long press events if button is still pressed. Default is 300 ms

    Returns number

  • Time in milliseconds to wait to raise long press events if button is still pressed. Default is 300 ms

    Parameters

    • value: number

    Returns void

  • get DragMovementThreshold(): number
  • set DragMovementThreshold(value: number): void
  • Gets or sets the distance in pixel that you have to move to prevent some events. Default is 10 pixels

    Returns number

  • Gets or sets the distance in pixel that you have to move to prevent some events. Default is 10 pixels

    Parameters

    • value: number

    Returns void

  • get ExclusiveDoubleClickMode(): boolean
  • set ExclusiveDoubleClickMode(value: boolean): void
  • If you need to check double click without raising a single click at first click, enable this flag

    Returns boolean

  • If you need to check double click without raising a single click at first click, enable this flag

    Parameters

    • value: boolean

    Returns void

  • get LongPressDelay(): number
  • set LongPressDelay(value: number): void
  • Time in milliseconds to wait to raise long press events if button is still pressed. Default is 500 ms

    Returns number

  • Time in milliseconds to wait to raise long press events if button is still pressed. Default is 500 ms

    Parameters

    • value: number

    Returns void

Methods

  • Adds the given action manager to this scene

    deprecated

    Parameters

    Returns void

  • Adds the given animation to this scene

    Parameters

    • newAnimation: Animation

      The animation to add

    Returns void

  • Adds the given animation group to this scene.

    Parameters

    Returns void

  • addCamera(newCamera: Camera): void
  • Adds the given camera to this scene

    Parameters

    • newCamera: Camera

      The camera to add

    Returns void

  • Adds the given effect layer to this scene

    Parameters

    • newEffectLayer: EffectLayer

      defines the effect layer to add

    Returns void

  • addExternalData<T>(key: string, data: T): boolean
  • Add an externally attached data from its key. This method call will fail and return false, if such key already exists. If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.

    Type Parameters

    • T extends Object

    Parameters

    • key: string

      the unique key that identifies the data

    • data: T

      the data object to associate to the key for this Engine instance

    Returns boolean

    true if no such key were already present and the data was added successfully, false otherwise

  • addGeometry(newGeometry: Geometry): void
  • Adds the given geometry to this scene

    Parameters

    • newGeometry: Geometry

      The geometry to add

    Returns void

  • addLight(newLight: Light): void
  • Adds the given light to this scene

    Parameters

    • newLight: Light

      The light to add

    Returns void

  • addMaterial(newMaterial: Material): void
  • Adds the given material to this scene

    Parameters

    • newMaterial: Material

      The material to add

    Returns void

  • Add a mesh to the list of scene's meshes

    Parameters

    • newMesh: AbstractMesh

      defines the mesh to add

    • Optional recursive: boolean

      if all child meshes should also be added to the scene

    Returns void

  • Adds the given morph target to this scene

    Parameters

    Returns void

  • Adds the given multi-material to this scene

    Parameters

    Returns void

  • Adds the given particle system to this scene

    Parameters

    Returns void

  • addPendingData(data: any): void
  • This function can help adding any object to the list of data awaited to be ready in order to check for a complete scene loading.

    Parameters

    • data: any

      defines the object to wait for

    Returns void

  • addSkeleton(newSkeleton: Skeleton): void
  • Adds the given skeleton to this scene

    Parameters

    • newSkeleton: Skeleton

      The skeleton to add

    Returns void

  • Adds the given texture to this scene.

    Parameters

    Returns void

  • Add a transform node to the list of scene's transform nodes

    Parameters

    • newTransformNode: TransformNode

      defines the transform node to add

    Returns void

  • animate(): void
  • Execute all animations (for a frame)

    Returns void

  • attachControl(attachUp?: boolean, attachDown?: boolean, attachMove?: boolean): void
  • Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp

    Parameters

    • Optional attachUp: boolean

      defines if you want to attach events to pointerup

    • Optional attachDown: boolean

      defines if you want to attach events to pointerdown

    • Optional attachMove: boolean

      defines if you want to attach events to pointermove

    Returns void

  • beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: (() => void), animatable?: Animatable, stopCurrent?: boolean, targetMask?: ((target: any) => boolean), onAnimationLoop?: (() => void), isAdditive?: boolean): Animatable
  • Will start the animation sequence of a given target

    Parameters

    • target: any

      defines the target

    • from: number

      defines from which frame should animation start

    • to: number

      defines until which frame should animation run.

    • Optional loop: boolean

      defines if the animation loops

    • Optional speedRatio: number

      defines the speed in which to run the animation (1.0 by default)

    • Optional onAnimationEnd: (() => void)

      defines the function to be executed when the animation ends

        • (): void
        • Returns void

    • Optional animatable: Animatable

      defines an animatable object. If not provided a new one will be created from the given params

    • Optional stopCurrent: boolean

      defines if the current animations must be stopped first (true by default)

    • Optional targetMask: ((target: any) => boolean)

      defines if the target should be animate if animations are present (this is called recursively on descendant animatables regardless of return value)

        • (target: any): boolean
        • Parameters

          • target: any

          Returns boolean

    • Optional onAnimationLoop: (() => void)

      defines the callback to call when an animation loops

        • (): void
        • Returns void

    • Optional isAdditive: boolean

      defines whether the animation should be evaluated additively (false by default)

    Returns Animatable

    the animatable object created for this animation

  • beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: (() => void), onAnimationLoop?: (() => void), isAdditive?: boolean): Animatable
  • Begin a new animation on a given node

    Parameters

    • target: any

      defines the target where the animation will take place

    • animations: Animation[]

      defines the list of animations to start

    • from: number

      defines the initial value

    • to: number

      defines the final value

    • Optional loop: boolean

      defines if you want animation to loop (off by default)

    • Optional speedRatio: number

      defines the speed ratio to apply to all animations

    • Optional onAnimationEnd: (() => void)

      defines the callback to call when an animation ends (will be called once per node)

        • (): void
        • Returns void

    • Optional onAnimationLoop: (() => void)

      defines the callback to call when an animation loops

        • (): void
        • Returns void

    • Optional isAdditive: boolean

      defines whether the animation should be evaluated additively (false by default)

    Returns Animatable

    the list of created animatables

  • beginDirectHierarchyAnimation(target: Node, directDescendantsOnly: boolean, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: (() => void), onAnimationLoop?: (() => void), isAdditive?: boolean): Animatable[]
  • Begin a new animation on a given node and its hierarchy

    Parameters

    • target: Node

      defines the root node where the animation will take place

    • directDescendantsOnly: boolean

      if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used.

    • animations: Animation[]

      defines the list of animations to start

    • from: number

      defines the initial value

    • to: number

      defines the final value

    • Optional loop: boolean

      defines if you want animation to loop (off by default)

    • Optional speedRatio: number

      defines the speed ratio to apply to all animations

    • Optional onAnimationEnd: (() => void)

      defines the callback to call when an animation ends (will be called once per node)

        • (): void
        • Returns void

    • Optional onAnimationLoop: (() => void)

      defines the callback to call when an animation loops

        • (): void
        • Returns void

    • Optional isAdditive: boolean

      defines whether the animation should be evaluated additively (false by default)

    Returns Animatable[]

    the list of animatables created for all nodes

  • beginHierarchyAnimation(target: any, directDescendantsOnly: boolean, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: (() => void), animatable?: Animatable, stopCurrent?: boolean, targetMask?: ((target: any) => boolean), onAnimationLoop?: (() => void), isAdditive?: boolean): Animatable[]
  • Will start the animation sequence of a given target and its hierarchy

    Parameters

    • target: any

      defines the target

    • directDescendantsOnly: boolean

      if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used.

    • from: number

      defines from which frame should animation start

    • to: number

      defines until which frame should animation run.

    • Optional loop: boolean

      defines if the animation loops

    • Optional speedRatio: number

      defines the speed in which to run the animation (1.0 by default)

    • Optional onAnimationEnd: (() => void)

      defines the function to be executed when the animation ends

        • (): void
        • Returns void

    • Optional animatable: Animatable

      defines an animatable object. If not provided a new one will be created from the given params

    • Optional stopCurrent: boolean

      defines if the current animations must be stopped first (true by default)

    • Optional targetMask: ((target: any) => boolean)

      defines if the target should be animated if animations are present (this is called recursively on descendant animatables regardless of return value)

        • (target: any): boolean
        • Parameters

          • target: any

          Returns boolean

    • Optional onAnimationLoop: (() => void)

      defines the callback to call when an animation loops

        • (): void
        • Returns void

    • Optional isAdditive: boolean

      defines whether the animation should be evaluated additively (false by default)

    Returns Animatable[]

    the list of created animatables

  • beginWeightedAnimation(target: any, from: number, to: number, weight: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: (() => void), animatable?: Animatable, targetMask?: ((target: any) => boolean), onAnimationLoop?: (() => void), isAdditive?: boolean): Animatable
  • Will start the animation sequence of a given target

    Parameters

    • target: any

      defines the target

    • from: number

      defines from which frame should animation start

    • to: number

      defines until which frame should animation run.

    • weight: number

      defines the weight to apply to the animation (1.0 by default)

    • Optional loop: boolean

      defines if the animation loops

    • Optional speedRatio: number

      defines the speed in which to run the animation (1.0 by default)

    • Optional onAnimationEnd: (() => void)

      defines the function to be executed when the animation ends

        • (): void
        • Returns void

    • Optional animatable: Animatable

      defines an animatable object. If not provided a new one will be created from the given params

    • Optional targetMask: ((target: any) => boolean)

      defines if the target should be animated if animations are present (this is called recursively on descendant animatables regardless of return value)

        • (target: any): boolean
        • Parameters

          • target: any

          Returns boolean

    • Optional onAnimationLoop: (() => void)

      defines the callback to call when an animation loops

        • (): void
        • Returns void

    • Optional isAdditive: boolean

      defines whether the animation should be evaluated additively (false by default)

    Returns Animatable

    the animatable object created for this animation

  • Bind the current view position to an effect.

    Parameters

    • effect: Nullable<Effect>

      The effect to be bound

    • Optional variableName: string

      name of the shader variable that will hold the eye position

    • Optional isVector3: boolean

      true to indicates that variableName is a Vector3 and not a Vector4

    Returns Vector4

    the computed eye position

  • cleanCachedTextureBuffer(): void
  • This function will remove the local cached buffer data from texture. It will save memory but will prevent the texture from being rebuilt

    Returns void

  • clearCachedVertexData(): void
  • Call this function to reduce memory footprint of the scene. Vertex buffers will not store CPU data anymore (this will prevent picking, collisions or physics to work correctly)

    Returns void

  • createDefaultCamera(createArcRotateCamera?: boolean, replace?: boolean, attachCameraControls?: boolean): void
  • Parameters

    • Optional createArcRotateCamera: boolean

      has the default false which creates a free camera, when true creates an arc rotate camera

    • Optional replace: boolean

      has default false, when true replaces the active camera in the scene

    • Optional attachCameraControls: boolean

      has default false, when true attaches camera controls to the canvas.

    Returns void

  • createDefaultCameraOrLight(createArcRotateCamera?: boolean, replace?: boolean, attachCameraControls?: boolean): void
  • Parameters

    • Optional createArcRotateCamera: boolean

      has the default false which creates a free camera, when true creates an arc rotate camera

    • Optional replace: boolean

      has the default false, when true replaces the active camera/light in the scene

    • Optional attachCameraControls: boolean

      has the default false, when true attaches camera controls to the canvas.

    Returns void

  • createDefaultLight(replace?: boolean): void
  • createDefaultSkybox(environmentTexture?: BaseTexture, pbr?: boolean, scale?: number, blur?: number, setGlobalEnvTexture?: boolean): Nullable<Mesh>
  • Parameters

    • Optional environmentTexture: BaseTexture

      defines the texture to use as environment texture

    • Optional pbr: boolean

      has default false which requires the StandardMaterial to be used, when true PBRMaterial must be used

    • Optional scale: number

      defines the overall scale of the skybox

    • Optional blur: number

      is only available when pbr is true, default is 0, no blur, maximum value is 1

    • Optional setGlobalEnvTexture: boolean

      has default true indicating that scene.environmentTexture must match the current skybox texture

    Returns Nullable<Mesh>

    a new mesh holding the sky box

  • createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree<AbstractMesh>
  • Creates a ray that can be used to pick in the scene

    Parameters

    • x: number

      defines the x coordinate of the origin (on-screen)

    • y: number

      defines the y coordinate of the origin (on-screen)

    • world: Nullable<Matrix>

      defines the world matrix to use if you want to pick in object space (instead of world space)

    • camera: Nullable<Camera>

      defines the camera to use for the picking

    • Optional cameraViewSpace: boolean

      defines if picking will be done in view space (false by default)

    Returns Ray

    a Ray

  • createPickingRayInCameraSpace(x: number, y: number, camera?: Camera): Ray
  • Creates a ray that can be used to pick in the scene

    Parameters

    • x: number

      defines the x coordinate of the origin (on-screen)

    • y: number

      defines the y coordinate of the origin (on-screen)

    • Optional camera: Camera

      defines the camera to use for the picking

    Returns Ray

    a Ray

  • createPickingRayInCameraSpaceToRef(x: number, y: number, result: Ray, camera?: Camera): Scene
  • Creates a ray that can be used to pick in the scene

    Parameters

    • x: number

      defines the x coordinate of the origin (on-screen)

    • y: number

      defines the y coordinate of the origin (on-screen)

    • result: Ray

      defines the ray where to store the picking ray

    • Optional camera: Camera

      defines the camera to use for the picking

    Returns Scene

    the current scene

  • Creates a ray that can be used to pick in the scene

    Parameters

    • x: number

      defines the x coordinate of the origin (on-screen)

    • y: number

      defines the y coordinate of the origin (on-screen)

    • world: Nullable<Matrix>

      defines the world matrix to use if you want to pick in object space (instead of world space)

    • result: Ray

      defines the ray where to store the picking ray

    • camera: Nullable<Camera>

      defines the camera to use for the picking

    • Optional cameraViewSpace: boolean

      defines if picking will be done in view space (false by default)

    • Optional enableDistantPicking: boolean

      defines if picking should handle large values for mesh position/scaling (false by default)

    Returns Scene

    the current scene

  • Creates a scene UBO

    Parameters

    • Optional name: string

      name of the uniform buffer (optional, for debugging purpose only)

    Returns UniformBuffer

    a new ubo

  • deleteCompoundImpostor(compound: any): void
  • Deletes a physics compound impostor

    Parameters

    • compound: any

      defines the compound to delete

    Returns void

  • detachControl(): void
  • Detaches all event handlers

    Returns void

  • Disables a depth renderer for a given camera

    Parameters

    • Optional camera: Nullable<Camera>

      The camera to disable the depth renderer on (default: scene's active camera)

    Returns void

  • disableFluidRenderer(): void
  • disableGeometryBufferRenderer(): void
  • Disables the GeometryBufferRender associated with the scene

    Returns void

  • disablePhysicsEngine(): void
  • Disables and disposes the physics engine associated with the scene

    Returns void

  • disablePrePassRenderer(): void
  • disableSubSurfaceForPrePass(): void
  • dispose(): void
  • Releases all held resources

    Returns void

  • enableDepthRenderer(camera?: Nullable<Camera>, storeNonLinearDepth?: boolean, force32bitsFloat?: boolean, samplingMode?: number, storeCameraSpaceZ?: boolean): DepthRenderer
  • Creates a depth renderer a given camera which contains a depth map which can be used for post processing.

    Parameters

    • Optional camera: Nullable<Camera>

      The camera to create the depth renderer on (default: scene's active camera)

    • Optional storeNonLinearDepth: boolean

      Defines whether the depth is stored linearly like in Babylon Shadows or directly like glFragCoord.z

    • Optional force32bitsFloat: boolean

      Forces 32 bits float when supported (else 16 bits float is prioritized over 32 bits float if supported)

    • Optional samplingMode: number

      The sampling mode to be used with the render target (Linear, Nearest...)

    • Optional storeCameraSpaceZ: boolean

      Defines whether the depth stored is the Z coordinate in camera space. If true, storeNonLinearDepth has no effect. (Default: false)

    Returns DepthRenderer

    the created depth renderer

  • Enables a GeometryBufferRender and associates it with the scene

    Parameters

    • Optional ratio: number

      defines the scaling ratio to apply to the renderer (1 by default which means same resolution)

    • Optional depthFormat: number

      Format of the depth texture (default: Constants.TEXTUREFORMAT_DEPTH16)

    Returns Nullable<GeometryBufferRenderer>

    the GeometryBufferRenderer

  • enablePhysics(gravity?: Nullable<Vector3>, plugin?: IPhysicsEnginePlugin | IPhysicsEnginePluginV2): boolean
  • Enables physics to the current scene

    Parameters

    • Optional gravity: Nullable<Vector3>

      defines the scene's gravity for the physics engine. defaults to real earth gravity : (0, -9.81, 0)

    • Optional plugin: IPhysicsEnginePlugin | IPhysicsEnginePluginV2

      defines the physics engine to be used. defaults to CannonJS.

    Returns boolean

    a boolean indicating if the physics engine was initialized

  • executeOnceBeforeRender(func: (() => void), timeout?: number): void
  • The provided function will run before render once and will be disposed afterwards. A timeout delay can be provided so that the function will be executed in N ms. The timeout is using the browser's native setTimeout so time percision cannot be guaranteed.

    Parameters

    • func: (() => void)

      The function to be executed.

        • (): void
        • Returns void

    • Optional timeout: number

      optional delay in ms

    Returns void

  • executeWhenReady(func: (() => void), checkRenderTargets?: boolean): void
  • Registers a function to be executed when the scene is ready

    Parameters

    • func: (() => void)

      the function to be executed

        • (): void
        • Returns void

    • Optional checkRenderTargets: boolean

      true to also check that the meshes rendered as part of a render target are ready (default: false)

    Returns void

  • Update the scene ubo before it can be used in rendering processing

    Returns UniformBuffer

    the scene UniformBuffer

  • freeActiveMeshes(): void
  • Clear the active meshes smart array preventing retention point in mesh dispose.

    Returns void

  • freeProcessedMaterials(): void
  • Clear the processed materials smart array preventing retention point in material dispose.

    Returns void

  • freeRenderingGroups(): void
  • Clear the info related to rendering groups preventing retention points during dispose.

    Returns void

  • freezeActiveMeshes(skipEvaluateActiveMeshes?: boolean, onSuccess?: (() => void), onError?: ((message: string) => void), freezeMeshes?: boolean, keepFrustumCulling?: boolean): Scene
  • Use this function to stop evaluating active meshes. The current list will be keep alive between frames

    Parameters

    • Optional skipEvaluateActiveMeshes: boolean

      defines an optional boolean indicating that the evaluate active meshes step must be completely skipped

    • Optional onSuccess: (() => void)

      optional success callback

        • (): void
        • Returns void

    • Optional onError: ((message: string) => void)

      optional error callback

        • (message: string): void
        • Parameters

          • message: string

          Returns void

    • Optional freezeMeshes: boolean

      defines if meshes should be frozen (true by default)

    • Optional keepFrustumCulling: boolean

      defines if you want to keep running the frustum clipping (false by default)

    Returns Scene

    the current scene

  • freezeMaterials(): void
  • Freeze all materials A frozen material will not be updatable but should be faster to render Note: multimaterials will not be frozen, but their submaterials will

    Returns void

  • getActiveBones(): number
  • Gets the total number of active bones rendered per frame

    Returns number

    the total number of active bones rendered per frame

  • getActiveIndices(): number
  • Gets the total number of active indices rendered per frame (You can deduce the number of rendered triangles by dividing this number by 3)

    Returns number

    the total number of active indices rendered per frame

  • Gets the array of active meshes

    Returns SmartArray<AbstractMesh>

    an array of AbstractMesh

  • getActiveParticles(): number
  • Gets the total number of active particles rendered per frame

    Returns number

    the total number of active particles rendered per frame

  • getAllAnimatablesByTarget(target: any): Animatable[]
  • Gets all animatables associated with a given target

    Parameters

    • target: any

      defines the target to look animatables for

    Returns Animatable[]

    an array of Animatables

  • Gets the animatable associated with a specific target

    Parameters

    • target: any

      defines the target of the animatable

    Returns Nullable<Animatable>

    the required animatable if found

  • get an animation group using its name

    Parameters

    • name: string

      defines the material's name

    Returns Nullable<AnimationGroup>

    the animation group or null if none found.

  • getAnimationRatio(): number
  • Gets the animation ratio (which is 1.0 is the scene renders at 60fps and 2 if the scene renders at 30fps, etc.)

    Returns number

    a number

  • Gets the current auto clear configuration for one rendering group of the rendering manager.

    Parameters

    • index: number

      the rendering group index to get the information for

    Returns IRenderingManagerAutoClearSetup

    The auto clear setup for the requested rendering group

  • Gets a bone using its Id

    deprecated

    Please use getBoneById instead

    Parameters

    • id: string

      defines the bone's Id

    Returns Nullable<Bone>

    the bone or null if not found

  • Gets a bone using its Id

    Parameters

    • id: string

      defines the bone's Id

    Returns Nullable<Bone>

    the bone or null if not found

  • Gets a bone using its id

    Parameters

    • name: string

      defines the bone's name

    Returns Nullable<Bone>

    the bone or null if not found

  • Gets the bounding box renderer associated with the scene

    Returns BoundingBoxRenderer

    a BoundingBoxRenderer

  • Gets the cached effect (ie. the latest rendered one)

    Returns Nullable<Effect>

    the cached effect

  • Gets the cached material (ie. the latest rendered one)

    Returns Nullable<Material>

    the cached material

  • Gets the cached visibility state (ie. the latest rendered one)

    Returns Nullable<number>

    the cached visibility state

  • Gets a camera using its Id

    deprecated

    Please use getCameraById instead

    Parameters

    • id: string

      defines the Id to look for

    Returns Nullable<Camera>

    the camera or null if not found

  • Gets a camera using its Id

    Parameters

    • id: string

      defines the Id to look for

    Returns Nullable<Camera>

    the camera or null if not found

  • Gets a camera using its name

    Parameters

    • name: string

      defines the camera's name

    Returns Nullable<Camera>

    the camera or null if none found.

  • Gets a camera using its unique Id

    deprecated

    Please use getCameraByUniqueId instead

    Parameters

    • uniqueId: number

      defines the unique Id to look for

    Returns Nullable<Camera>

    the camera or null if not found

  • Gets a camera using its unique Id

    Parameters

    • uniqueId: number

      defines the unique Id to look for

    Returns Nullable<Camera>

    the camera or null if not found

  • getCamerasByTags(tagsQuery: string, forEach?: ((camera: Camera) => void)): Camera[]
  • Get a list of cameras by tags

    Parameters

    • tagsQuery: string

      defines the tags query to use

    • Optional forEach: ((camera: Camera) => void)

      defines a predicate used to filter results

    Returns Camera[]

    an array of Camera

  • getClassName(): string
  • Gets a string identifying the name of the class

    Returns string

    "Scene" string

  • Gets the engine associated with the scene

    Returns Engine

    an Engine

  • getExternalData<T>(key: string): Nullable<T>
  • Get an externally attached data from its key

    Type Parameters

    • T

    Parameters

    • key: string

      the unique key that identifies the data

    Returns Nullable<T>

    the associated data, if present (can be null), or undefined if not present

  • getFrameId(): number
  • Gets an unique Id for the current frame

    Returns number

    a number

  • Gets the list of geometries attached to the scene

    Returns Geometry[]

    an array of Geometry

  • Gets a geometry using its Id

    deprecated

    Please use getGeometryById instead

    Parameters

    • id: string

      defines the geometry's Id

    Returns Nullable<Geometry>

    the geometry or null if none found.

  • Gets a geometry using its Id

    Parameters

    • id: string

      defines the geometry's Id

    Returns Nullable<Geometry>

    the geometry or null if none found.

  • Return the first glow layer of the scene with a given name.

    Parameters

    • name: string

      The name of the glow layer to look for.

    Returns Nullable<GlowLayer>

    The glow layer if found otherwise null.

  • Return a the first highlight layer of the scene with a given name.

    Parameters

    • name: string

      The name of the highlight layer to look for.

    Returns Nullable<HighlightLayer>

    The highlight layer if found otherwise null.

  • getInternalStep(): number
  • Gets a the last added node (Mesh, Camera, Light) using a given Id

    deprecated

    Please use getLastEntryById instead

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<Node>

    the found node or null if not found at all

  • Gets a the last added node (Mesh, Camera, Light) using a given Id

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<Node>

    the found node or null if not found at all

  • Gets a the last added material using a given id

    deprecated

    Please use getLastMaterialById instead

    Parameters

    • id: string

      defines the material's Id

    Returns Nullable<Material>

    the last material with the given id or null if none found.

  • getLastMaterialById(id: string, allowMultiMaterials?: boolean): Nullable<Material>
  • Gets a last added material using a given id

    Parameters

    • id: string

      defines the material's id

    • Optional allowMultiMaterials: boolean

      determines whether multimaterials should be considered

    Returns Nullable<Material>

    the last material with the given id or null if none found.

  • Gets a the last added mesh using a given Id

    deprecated

    Please use getLastMeshById instead

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<AbstractMesh>

    the found mesh or null if not found at all.

  • Gets a the last added mesh using a given Id

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<AbstractMesh>

    the found mesh or null if not found at all.

  • Gets a skeleton using a given Id (if many are found, this function will pick the last one)

    deprecated

    Please use getLastSkeletonById instead

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<Skeleton>

    the found skeleton or null if not found at all.

  • Gets a skeleton using a given Id (if many are found, this function will pick the last one)

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<Skeleton>

    the found skeleton or null if not found at all.

  • Gets a the last transform node using a given Id

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<TransformNode>

    the found mesh or null if not found at all.

  • Gets a lens flare system using its Id

    deprecated

    Please use getLensFlareSystemById instead

    Parameters

    • id: string

      defines the Id to look for

    Returns Nullable<LensFlareSystem>

    the lens flare system or null if not found

  • Gets a light node using its Id

    deprecated

    Please use getLightById instead

    Parameters

    • id: string

      defines the light's Id

    Returns Nullable<Light>

    the light or null if none found.

  • Gets a light node using its Id

    Parameters

    • id: string

      defines the light's Id

    Returns Nullable<Light>

    the light or null if none found.

  • Gets a light node using its name

    Parameters

    • name: string

      defines the the light's name

    Returns Nullable<Light>

    the light or null if none found.

  • Gets a light node using its scene-generated unique Id

    deprecated

    Please use getLightByUniqueId instead

    Parameters

    • uniqueId: number

      defines the light's unique Id

    Returns Nullable<Light>

    the light or null if none found.

  • Gets a light node using its scene-generated unique Id

    Parameters

    • uniqueId: number

      defines the light's unique Id

    Returns Nullable<Light>

    the light or null if none found.

  • getLightsByTags(tagsQuery: string, forEach?: ((light: Light) => void)): Light[]
  • Get a list of lights by tags

    Parameters

    • tagsQuery: string

      defines the tags query to use

    • Optional forEach: ((light: Light) => void)

      defines a predicate used to filter results

        • Parameters

          Returns void

    Returns Light[]

    an array of Light

  • Get a material using its id

    deprecated

    Please use getMaterialById instead

    Parameters

    • id: string

      defines the material's Id

    Returns Nullable<Material>

    the material or null if none found.

  • get a material using its id

    Parameters

    • id: string

      defines the material's Id

    • Optional allowMultiMaterials: boolean

      determines whether multimaterials should be considered

    Returns Nullable<Material>

    the material or null if none found.

  • getMaterialByName(name: string, allowMultiMaterials?: boolean): Nullable<Material>
  • Gets a material using its name

    Parameters

    • name: string

      defines the material's name

    • Optional allowMultiMaterials: boolean

      determines whether multimaterials should be considered

    Returns Nullable<Material>

    the material or null if none found.

  • getMaterialByTags(tagsQuery: string, forEach?: ((material: Material) => void)): Material[]
  • Get a list of materials by tags

    Parameters

    • tagsQuery: string

      defines the tags query to use

    • Optional forEach: ((material: Material) => void)

      defines a predicate used to filter results

    Returns Material[]

    an array of Material

  • getMaterialByUniqueID(uniqueId: number, allowMultiMaterials?: boolean): Nullable<Material>
  • Get a material using its unique id

    Parameters

    • uniqueId: number

      defines the material's unique id

    • Optional allowMultiMaterials: boolean

      determines whether multimaterials should be considered

    Returns Nullable<Material>

    the material or null if none found.

  • Gets the first added mesh found of a given Id

    deprecated

    Please use getMeshById instead

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<AbstractMesh>

    the mesh found or null if not found at all

  • Gets the first added mesh found of a given Id

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<AbstractMesh>

    the mesh found or null if not found at all

  • Gets a mesh using a given name

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<AbstractMesh>

    the found mesh or null if not found at all.

  • Gets a mesh with its auto-generated unique Id

    deprecated

    Please use getMeshByUniqueId instead

    Parameters

    • uniqueId: number

      defines the unique Id to search for

    Returns Nullable<AbstractMesh>

    the found mesh or null if not found at all.

  • Gets a mesh with its auto-generated unique Id

    Parameters

    • uniqueId: number

      defines the unique Id to search for

    Returns Nullable<AbstractMesh>

    the found mesh or null if not found at all.

  • Gets a list of meshes using their Id

    deprecated

    Please use getMeshesById instead

    Parameters

    • id: string

      defines the Id to search for

    Returns AbstractMesh[]

    a list of meshes

  • Gets a list of meshes using their Id

    Parameters

    • id: string

      defines the Id to search for

    Returns AbstractMesh[]

    a list of meshes

  • getMeshesByTags(tagsQuery: string, forEach?: ((mesh: AbstractMesh) => void)): Mesh[]
  • Get a list of meshes by tags

    Parameters

    • tagsQuery: string

      defines the tags query to use

    • Optional forEach: ((mesh: AbstractMesh) => void)

      defines a predicate used to filter results

    Returns Mesh[]

    an array of Mesh

  • Gets a morph target using a given id (if many are found, this function will pick the first one)

    Parameters

    • id: string

      defines the id to search for

    Returns Nullable<MorphTarget>

    the found morph target or null if not found at all.

  • Gets a morph target using a given name (if many are found, this function will pick the first one)

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<MorphTarget>

    the found morph target or null if not found at all.

  • Gets a morph target manager using a given id (if many are found, this function will pick the last one)

    Parameters

    • id: number

      defines the id to search for

    Returns Nullable<MorphTargetManager>

    the found morph target manager or null if not found at all.

  • Gets a node (Mesh, Camera, Light) using a given Id

    deprecated

    Please use getNodeById instead

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<Node>

    the found node or null if not found at all

  • Gets a node (Mesh, Camera, Light) using a given Id

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<Node>

    the found node or null if not found at all

  • Gets a node (Mesh, Camera, Light) using a given name

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<Node>

    the found node or null if not found at all.

  • Returns Node[]

    all meshes, lights, cameras, transformNodes and bones

  • getOrAddExternalDataWithFactory<T>(key: string, factory: ((k: string) => T)): T
  • Get an externally attached data from its key, create it using a factory if it's not already present

    Type Parameters

    • T extends Object

    Parameters

    • key: string

      the unique key that identifies the data

    • factory: ((k: string) => T)

      the factory that will be called to create the instance if and only if it doesn't exists

        • (k: string): T
        • Parameters

          • k: string

          Returns T

    Returns T

    the associated data, can be null if the factory returned null.

  • Gets the outline renderer associated with the scene

    Returns OutlineRenderer

    a OutlineRenderer

  • Gets a particle system by Id

    deprecated

    Please use getParticleSystemById instead

    Parameters

    • id: string

      defines the particle system Id

    Returns Nullable<IParticleSystem>

    the corresponding system or null if none found

  • Gets a particle system by Id

    Parameters

    • id: string

      defines the particle system Id

    Returns Nullable<IParticleSystem>

    the corresponding system or null if none found

  • This method gets the performance collector belonging to the scene, which is generally shared with the inspector.

    Returns PerformanceViewerCollector

    the perf collector belonging to the scene.

  • Gets the current physics engine

    Returns Nullable<IPhysicsEngine>

    a IPhysicsEngine or null if none attached

  • Gets the mesh under the pointer

    Returns Nullable<AbstractMesh>

    a Mesh or null if no mesh is under the pointer

  • Gets the sprite under the pointer

    Returns Nullable<Sprite>

    a Sprite or null if no sprite is under the pointer

  • Gets a post process using a given name (if many are found, this function will pick the first one)

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<PostProcess>

    the found post process or null if not found at all.

  • Gets the current projection matrix

    Returns Matrix

    a Matrix

  • getRenderId(): number
  • Gets an unique Id for the current render phase

    Returns number

    a number

  • Gets the uniform buffer used to store scene data

    Returns UniformBuffer

    a UniformBuffer

  • Gets a skeleton using a given id (if many are found, this function will pick the first one)

    Parameters

    • id: string

      defines the id to search for

    Returns Nullable<Skeleton>

    the found skeleton or null if not found at all.

  • Gets a skeleton using a given name

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<Skeleton>

    the found skeleton or null if not found at all.

  • Gets a skeleton using a given auto generated unique id

    Parameters

    • uniqueId: number

      defines the unique id to search for

    Returns Nullable<Skeleton>

    the found skeleton or null if not found at all.

  • Gets a sound using a given name

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<Sound>

    the found sound or null if not found at all.

  • getStepId(): number
  • Gets a texture using its name

    Parameters

    • name: string

      defines the texture's name

    Returns Nullable<BaseTexture>

    the texture or null if none found.

  • Get a texture using its unique id

    deprecated

    Please use getTextureByUniqueId instead

    Parameters

    • uniqueId: number

      defines the texture's unique id

    Returns Nullable<BaseTexture>

    the texture or null if none found.

  • Get a texture using its unique id

    Parameters

    • uniqueId: number

      defines the texture's unique id

    Returns Nullable<BaseTexture>

    the texture or null if none found.

  • getTotalVertices(): number
  • Gets the total number of vertices rendered per frame

    Returns number

    the total number of vertices rendered per frame

  • Gets the current transform matrix

    Returns Matrix

    a Matrix made of View * Projection

  • Gets the first added transform node found of a given Id

    deprecated

    Please use getTransformNodeById instead

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<TransformNode>

    the found transform node or null if not found at all.

  • Gets the first added transform node found of a given Id

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<TransformNode>

    the found transform node or null if not found at all.

  • Gets a transform node using a given name

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<TransformNode>

    the found transform node or null if not found at all.

  • Gets a transform node with its auto-generated unique Id

    deprecated

    Please use getTransformNodeByUniqueId instead

    Parameters

    • uniqueId: number

      defines the unique Id to search for

    Returns Nullable<TransformNode>

    the found transform node or null if not found at all.

  • Gets a transform node with its auto-generated unique Id

    Parameters

    • uniqueId: number

      defines the unique Id to search for

    Returns Nullable<TransformNode>

    the found transform node or null if not found at all.

  • Gets a list of transform nodes using their Id

    deprecated

    Please use getTransformNodesById instead

    Parameters

    • id: string

      defines the Id to search for

    Returns TransformNode[]

    a list of transform nodes

  • Gets a list of transform nodes using their Id

    Parameters

    • id: string

      defines the Id to search for

    Returns TransformNode[]

    a list of transform nodes

  • Get a list of transform nodes by tags

    Parameters

    • tagsQuery: string

      defines the tags query to use

    • Optional forEach: ((transform: TransformNode) => void)

      defines a predicate used to filter results

    Returns TransformNode[]

    an array of TransformNode

  • getUniqueId(): number
  • Gets an unique (relatively to the current scene) Id

    Returns number

    an unique number for the scene

  • Gets the current view matrix

    Returns Matrix

    a Matrix

  • getWaitingItemsCount(): number
  • Returns the number of items waiting to be loaded

    Returns number

    the number of items waiting to be loaded

  • Get the world extend vectors with an optional filter

    Parameters

    • Optional filterPredicate: ((mesh: AbstractMesh) => boolean)

      the predicate - which meshes should be included when calculating the world size

    Returns { max: Vector3; min: Vector3 }

    min and max vectors

  • incrementRenderId(): void
  • Call this function if you want to manually increment the render Id

    Returns void

  • Gets a boolean indicating if the given mesh is active

    Parameters

    Returns boolean

    true if the mesh is in the active list

  • isCachedMaterialInvalid(material: Material, effect: Effect, visibility?: number): boolean
  • Gets a boolean indicating if the current material / effect / visibility must be bind again

    Parameters

    • material: Material

      defines the current material

    • effect: Effect

      defines the current effect

    • Optional visibility: number

      defines the current visibility state

    Returns boolean

    true if one parameter is not cached

  • isPhysicsEnabled(): boolean
  • Gets a boolean indicating if there is an active physics engine

    Returns boolean

    a boolean indicating if there is an active physics engine

  • isPointerCaptured(pointerId?: number): boolean
  • Gets a boolean indicating if the current pointer event is captured (meaning that the scene has already handled the pointer down)

    Parameters

    • Optional pointerId: number

      defines the pointer id to use in a multi-touch scenario (0 by default)

    Returns boolean

    true if the pointer was captured

  • isReady(checkRenderTargets?: boolean): boolean
  • This function will check if the scene can be rendered (textures are loaded, shaders are compiled) Delay loaded resources are not taking in account

    Parameters

    • Optional checkRenderTargets: boolean

      true to also check that the meshes rendered as part of a render target are ready (default: true)

    Returns boolean

    true if all required resources are ready

  • markAllMaterialsAsDirty(flag: number, predicate?: ((mat: Material) => boolean)): void
  • Will flag all materials as dirty to trigger new shader compilation

    Parameters

    • flag: number

      defines the flag used to specify which material part must be marked as dirty

    • Optional predicate: ((mat: Material) => boolean)

      If not null, it will be used to specify if a material has to be marked as dirty

    Returns void

  • Launch a ray to try to pick a mesh in the scene. A mesh triangle can be picked both from its front and back sides, irrespective of orientation.

    Parameters

    • x: number

      X position on screen

    • y: number

      Y position on screen

    • Optional predicate: ((mesh: AbstractMesh) => boolean)

      Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true

    • Optional camera: Camera

      camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used

    • Optional trianglePredicate: TrianglePickingPredicate

      defines an optional predicate used to select faces when a mesh intersection is detected

    Returns Nullable<PickingInfo[]>

    an array of PickingInfo

  • Launch a ray to try to pick sprites in the scene

    Parameters

    • x: number

      position on screen

    • y: number

      position on screen

    • Optional predicate: ((sprite: Sprite) => boolean)

      Predicate function used to determine eligible sprites. Can be set to null. In this case, a sprite must have isPickable set to true

        • Parameters

          Returns boolean

    • Optional camera: Camera

      camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used

    Returns Nullable<PickingInfo[]>

    a PickingInfo array

  • Use the given ray to pick sprites in the scene

    Parameters

    • ray: Ray

      The ray (in world space) to use to pick meshes

    • Optional predicate: ((sprite: Sprite) => boolean)

      Predicate function used to determine eligible sprites. Can be set to null. In this case, a sprite must have isPickable set to true

        • Parameters

          Returns boolean

    • Optional camera: Camera

      camera to use. Can be set to null. In this case, the scene.activeCamera will be used

    Returns Nullable<PickingInfo[]>

    a PickingInfo array

  • Launch a ray to try to pick a mesh in the scene

    Parameters

    • ray: Ray

      Ray to use

    • Optional predicate: ((mesh: AbstractMesh) => boolean)

      Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true

    • Optional trianglePredicate: TrianglePickingPredicate

      defines an optional predicate used to select faces when a mesh intersection is detected

    Returns Nullable<PickingInfo[]>

    an array of PickingInfo

  • Launch a ray to try to pick a mesh in the scene

    Parameters

    • x: number

      position on screen

    • y: number

      position on screen

    • Optional predicate: ((mesh: AbstractMesh) => boolean)

      Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true

    • Optional fastCheck: boolean

      defines if the first intersection will be used (and not the closest)

    • Optional camera: Nullable<Camera>

      to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used

    • Optional trianglePredicate: TrianglePickingPredicate

      defines an optional predicate used to select faces when a mesh intersection is detected

    Returns PickingInfo

    a PickingInfo

  • Launch a ray to try to pick a sprite in the scene

    Parameters

    • x: number

      position on screen

    • y: number

      position on screen

    • Optional predicate: ((sprite: Sprite) => boolean)

      Predicate function used to determine eligible sprites. Can be set to null. In this case, a sprite must have isPickable set to true

        • Parameters

          Returns boolean

    • Optional fastCheck: boolean

      defines if the first intersection will be used (and not the closest)

    • Optional camera: Camera

      camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used

    Returns Nullable<PickingInfo>

    a PickingInfo

  • Use the given ray to pick a sprite in the scene

    Parameters

    • ray: Ray

      The ray (in world space) to use to pick meshes

    • Optional predicate: ((sprite: Sprite) => boolean)

      Predicate function used to determine eligible sprites. Can be set to null. In this case, a sprite must have isPickable set to true

        • Parameters

          Returns boolean

    • Optional fastCheck: boolean

      defines if the first intersection will be used (and not the closest)

    • Optional camera: Camera

      camera to use. Can be set to null. In this case, the scene.activeCamera will be used

    Returns Nullable<PickingInfo>

    a PickingInfo

  • Launch a ray to try to pick a mesh in the scene using only bounding information of the main mesh (not using submeshes)

    Parameters

    • x: number

      position on screen

    • y: number

      position on screen

    • Optional predicate: ((mesh: AbstractMesh) => boolean)

      Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true

    • Optional fastCheck: boolean

      defines if the first intersection will be used (and not the closest)

    • Optional camera: Nullable<Camera>

      to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used

    Returns Nullable<PickingInfo>

    a PickingInfo (Please note that some info will not be set like distance, bv, bu and everything that cannot be capture by only using bounding infos)

  • Use the given ray to pick a mesh in the scene. A mesh triangle can be picked both from its front and back sides, irrespective of orientation.

    Parameters

    • ray: Ray

      The ray to use to pick meshes

    • Optional predicate: ((mesh: AbstractMesh) => boolean)

      Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must have isPickable set to true

    • Optional fastCheck: boolean

      defines if the first intersection will be used (and not the closest)

    • Optional trianglePredicate: TrianglePickingPredicate

      defines an optional predicate used to select faces when a mesh intersection is detected

    Returns Nullable<PickingInfo>

    a PickingInfo

  • pushGeometry(geometry: Geometry, force?: boolean): boolean
  • Add a new geometry to this scene

    Parameters

    • geometry: Geometry

      defines the geometry to be added to the scene.

    • Optional force: boolean

      defines if the geometry must be pushed even if a geometry with this id already exists

    Returns boolean

    a boolean defining if the geometry was added or not

  • registerAfterRender(func: (() => void)): void
  • Registers a function to be called after every frame render

    Parameters

    • func: (() => void)

      defines the function to register

        • (): void
        • Returns void

    Returns void

  • registerBeforeRender(func: (() => void)): void
  • Registers a function to be called before every frame render

    Parameters

    • func: (() => void)

      defines the function to register

        • (): void
        • Returns void

    Returns void

  • Removes the given action manager from this scene.

    deprecated

    Parameters

    Returns number

    The index of the removed action manager

  • Remove a animation for the list of scene's animations

    Parameters

    • toRemove: Animation

      defines the animation to remove

    Returns number

    the index where the animation was in the animation list

  • Removes the given animation group from this scene.

    Parameters

    Returns number

    The index of the removed animation group

  • removeCamera(toRemove: Camera): number
  • Remove a camera for the list of scene's cameras

    Parameters

    • toRemove: Camera

      defines the camera to remove

    Returns number

    the index where the camera was in the camera list

  • Removes the given effect layer from this scene.

    Parameters

    • toRemove: EffectLayer

      defines the effect layer to remove

    Returns number

    the index of the removed effect layer

  • removeExternalData(key: string): boolean
  • Remove an externally attached data from the Engine instance

    Parameters

    • key: string

      the unique key that identifies the data

    Returns boolean

    true if the data was successfully removed, false if it doesn't exist

  • removeGeometry(geometry: Geometry): boolean
  • Removes an existing geometry

    Parameters

    • geometry: Geometry

      defines the geometry to be removed from the scene

    Returns boolean

    a boolean defining if the geometry was removed or not

  • Removes the given lens flare system from this scene.

    Parameters

    Returns number

    The index of the removed lens flare system

  • removeLight(toRemove: Light): number
  • Remove a light for the list of scene's lights

    Parameters

    • toRemove: Light

      defines the light to remove

    Returns number

    the index where the light was in the light list

  • removeMaterial(toRemove: Material): number
  • Removes the given material from this scene.

    Parameters

    • toRemove: Material

      The material to remove

    Returns number

    The index of the removed material

  • removeMesh(toRemove: AbstractMesh, recursive?: boolean): number
  • Remove a mesh for the list of scene's meshes

    Parameters

    • toRemove: AbstractMesh

      defines the mesh to remove

    • Optional recursive: boolean

      if all child meshes should also be removed from the scene

    Returns number

    the index where the mesh was in the mesh list

  • Remove a morph target for the list of scene's morph targets

    Parameters

    Returns number

    the index where the morph target was in the morph target list

  • Removes the given multi-material from this scene.

    Parameters

    Returns number

    The index of the removed multi-material

  • Remove a particle system for the list of scene's particle systems

    Parameters

    Returns number

    the index where the particle system was in the particle system list

  • removePendingData(data: any): void
  • Remove a pending data from the loading list which has previously been added with addPendingData.

    Parameters

    • data: any

      defines the object to remove from the pending list

    Returns void

  • Removes the given reflection probe from this scene.

    Parameters

    Returns number

    The index of the removed reflection probe

  • removeSkeleton(toRemove: Skeleton): number
  • Remove a skeleton for the list of scene's skeletons

    Parameters

    • toRemove: Skeleton

      defines the skeleton to remove

    Returns number

    the index where the skeleton was in the skeleton list

  • Removes the given texture from this scene.

    Parameters

    Returns number

    The index of the removed texture

  • Remove a transform node for the list of scene's transform nodes

    Parameters

    Returns number

    the index where the transform node was in the transform node list

  • render(updateCameras?: boolean, ignoreAnimations?: boolean): void
  • Render the scene

    Parameters

    • Optional updateCameras: boolean

      defines a boolean indicating if cameras must update according to their inputs (true by default)

    • Optional ignoreAnimations: boolean

      defines a boolean indicating if animations should not be executed (false by default)

    Returns void

  • resetCachedMaterial(): void
  • Resets all cached information relative to material (including effect and visibility)

    Returns void

  • resetDrawCache(passId?: number): void
  • Resets the draw wrappers cache of all meshes

    Parameters

    • Optional passId: number

      If provided, releases only the draw wrapper corresponding to this render pass id

    Returns void

  • resetLastAnimationTimeFrame(): void
  • Resets the last animation time frame. Useful to override when animations start running when loading a scene for the first time.

    Returns void

  • Sets the active camera of the scene using its Id

    deprecated

    Please use setActiveCameraById instead

    Parameters

    • id: string

      defines the camera's Id

    Returns Nullable<Camera>

    the new active camera or null if none found.

  • sets the active camera of the scene using its Id

    Parameters

    • id: string

      defines the camera's Id

    Returns Nullable<Camera>

    the new active camera or null if none found.

  • sets the active camera of the scene using its name

    Parameters

    • name: string

      defines the camera's name

    Returns Nullable<Camera>

    the new active camera or null if none found.

  • setDefaultCandidateProviders(): void
  • Sets the default candidate providers for the scene. This sets the getActiveMeshCandidates, getActiveSubMeshCandidates, getIntersectingSubMeshCandidates and getCollidingSubMeshCandidates to their default function

    Returns void

  • Force the value of meshUnderPointer

    Parameters

    • mesh: Nullable<AbstractMesh>

      defines the mesh to use

    • Optional pointerId: number

      optional pointer id when using more than one pointer

    • Optional pickResult: Nullable<PickingInfo>

      optional pickingInfo data used to find mesh

    Returns void

  • Force the sprite under the pointer

    Parameters

    Returns void

  • setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean, depth?: boolean, stencil?: boolean): void
  • Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.

    Parameters

    • renderingGroupId: number

      The rendering group id corresponding to its index

    • autoClearDepthStencil: boolean

      Automatically clears depth and stencil between groups if true.

    • Optional depth: boolean

      Automatically clears depth between groups if true and autoClear is true.

    • Optional stencil: boolean

      Automatically clears stencil between groups if true and autoClear is true.

    Returns void

  • Overrides the default sort function applied in the rendering group to prepare the meshes. This allowed control for front to back rendering or reversly depending of the special needs.

    Parameters

    • renderingGroupId: number

      The rendering group id corresponding to its index

    • Optional opaqueSortCompareFn: Nullable<((a: SubMesh, b: SubMesh) => number)>

      The opaque queue comparison function use to sort.

    • Optional alphaTestSortCompareFn: Nullable<((a: SubMesh, b: SubMesh) => number)>

      The alpha test queue comparison function use to sort.

    • Optional transparentSortCompareFn: Nullable<((a: SubMesh, b: SubMesh) => number)>

      The transparent queue comparison function use to sort.

    Returns void

  • Sets the scene ubo

    Parameters

    Returns void

  • setStepId(newStepId: number): void
  • Sets the current transform matrix

    Parameters

    • viewL: Matrix

      defines the View matrix to use

    • projectionL: Matrix

      defines the Projection matrix to use

    • Optional viewR: Matrix

      defines the right View matrix to use (if provided)

    • Optional projectionR: Matrix

      defines the right Projection matrix to use (if provided)

    Returns void

  • simulatePointerDown(pickResult: PickingInfo, pointerEventInit?: PointerEventInit): Scene
  • Use this method to simulate a pointer down on a mesh The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay

    Parameters

    • pickResult: PickingInfo

      pickingInfo of the object wished to simulate pointer event on

    • Optional pointerEventInit: PointerEventInit

      pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)

    Returns Scene

    the current scene

  • simulatePointerMove(pickResult: PickingInfo, pointerEventInit?: PointerEventInit): Scene
  • Use this method to simulate a pointer move on a mesh The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay

    Parameters

    • pickResult: PickingInfo

      pickingInfo of the object wished to simulate pointer event on

    • Optional pointerEventInit: PointerEventInit

      pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)

    Returns Scene

    the current scene

  • simulatePointerUp(pickResult: PickingInfo, pointerEventInit?: PointerEventInit, doubleTap?: boolean): Scene
  • Use this method to simulate a pointer up on a mesh The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay

    Parameters

    • pickResult: PickingInfo

      pickingInfo of the object wished to simulate pointer event on

    • Optional pointerEventInit: PointerEventInit

      pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)

    • Optional doubleTap: boolean

      indicates that the pointer up event should be considered as part of a double click (false by default)

    Returns Scene

    the current scene

  • sortActiveAnimatables(): void
  • Sort active animatables based on their playOrder property

    Returns void

  • sortLightsByPriority(): void
  • Sorts the list list based on light priorities

    Returns void

  • stopAllAnimations(): void
  • Stops and removes all animations that have been applied to the scene

    Returns void

  • stopAnimation(target: any, animationName?: string, targetMask?: ((target: any) => boolean)): void
  • Will stop the animation of the given target

    Parameters

    • target: any

      the target

    • Optional animationName: string

      the name of the animation to stop (all animations will be stopped if both this and targetMask are empty)

    • Optional targetMask: ((target: any) => boolean)

      a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)

        • (target: any): boolean
        • Parameters

          • target: any

          Returns boolean

    Returns void

  • switchActiveCamera(newCamera: Camera, attachControl?: boolean): void
  • Switch active camera

    Parameters

    • newCamera: Camera

      defines the new active camera

    • Optional attachControl: boolean

      defines if attachControl must be called for the new active camera (default: true)

    Returns void

  • unfreezeActiveMeshes(): Scene
  • Use this function to restart evaluating active meshes on every frame

    Returns Scene

    the current scene

  • unfreezeMaterials(): void
  • Unfreeze all materials A frozen material will not be updatable but should be faster to render

    Returns void

  • unregisterAfterRender(func: (() => void)): void
  • Unregisters a function called after every frame render

    Parameters

    • func: (() => void)

      defines the function to unregister

        • (): void
        • Returns void

    Returns void

  • unregisterBeforeRender(func: (() => void)): void
  • Unregisters a function called before every frame render

    Parameters

    • func: (() => void)

      defines the function to unregister

        • (): void
        • Returns void

    Returns void

  • updateTransformMatrix(force?: boolean): void
  • Update the transform matrix to update from the current active camera

    Parameters

    • Optional force: boolean

      defines a boolean used to force the update even if cache is up to date

    Returns void

  • whenReadyAsync(checkRenderTargets?: boolean): Promise<void>
  • Returns a promise that resolves when the scene is ready

    Parameters

    • Optional checkRenderTargets: boolean

      true to also check that the meshes rendered as part of a render target are ready (default: false)

    Returns Promise<void>

    A promise that resolves when the scene is ready

  • Adds a parser in the list of available ones

    Parameters

    • name: string

      Defines the name of the parser

    • parser: BabylonFileParser

      Defines the parser to add

    Returns void

  • CollisionCoordinatorFactory(): ICollisionCoordinator
  • Factory used to create the a collision coordinator.

    Returns ICollisionCoordinator

    The collision coordinator

  • Factory used to create the default material.

    Parameters

    • scene: Scene

      The scene to create the material for

    Returns Material

    The default material

  • Gets a general parser from the list of available ones

    Parameters

    • name: string

      Defines the name of the parser

    Returns Nullable<BabylonFileParser>

    the requested parser or null

  • Parser json data and populate both a scene and its associated container object

    Parameters

    • jsonData: any

      Defines the data to parse

    • scene: Scene

      Defines the scene to parse the data for

    • container: AssetContainer

      Defines the container attached to the parsing sequence

    • rootUrl: string

      Defines the root url of the data

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Property
  • Method
  • Static property
  • Static method

Settings

Theme