Represents a scene to be rendered by the engine.

See

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

Hierarchy

  • AbstractScene
    • Scene

Implements

  • IAnimatable
  • IClipPlanesHolder

Constructors

Properties

_afterRenderTargetPostProcessStage actionManager actionManagers ambientColor animationGroups animationTimeScale animations animationsEnabled audioEnabled audioListenerPositionProvider audioListenerRotationProvider audioPositioningRefreshRate autoClear autoClearDepthAndStencil cameraToUseForPointers cameras clearColor clipPlane clipPlane2 clipPlane3 clipPlane4 clipPlane5 clipPlane6 collisionsEnabled constantlyUpdateMeshUnderPointer customLODSelector customRenderTargets debugLayer defaultCursor deltaTime disableOfflineSupportExceptionRules dispatchAllSubMeshesOfActiveMeshes doNotHandleCursors dumpNextRenderTargets effectLayers environmentBRDFTexture environmentIntensity fogColor fogDensity fogEnd fogStart forceShowBoundingBoxes gamepadManager geometries getActiveMeshCandidates getActiveSubMeshCandidates getCollidingSubMeshCandidates getDeterministicFrameTime getIntersectingSubMeshCandidates gravity headphone hoverCursor importedMeshesFiles lensFlaresEnabled lights loadingPluginName mainSoundTrack materials meshes metadata morphTargetManagers multiMaterials needsPreviousWorldMatrices offlineProvider onActiveCameraChanged onActiveCamerasChanged onAfterActiveMeshesEvaluationObservable onAfterAnimationsObservable onAfterCameraRenderObservable onAfterDrawPhaseObservable onAfterParticlesRenderingObservable onAfterPhysicsObservable onAfterRenderCameraObservable onAfterRenderObservable onAfterRenderTargetsRenderObservable onAfterRenderingGroupObservable onAfterSpritesRenderingObservable onAfterStepObservable onAnimationFileImportedObservable onBeforeActiveMeshesEvaluationObservable onBeforeAnimationsObservable onBeforeCameraRenderObservable onBeforeDrawPhaseObservable onBeforeParticlesRenderingObservable onBeforePhysicsObservable onBeforeRenderObservable onBeforeRenderTargetsRenderObservable onBeforeRenderingGroupObservable onBeforeSpritesRenderingObservable onBeforeStepObservable onCameraRemovedObservable onDataLoadedObservable onDisposeObservable onGeometryRemovedObservable onKeyboardObservable onLightRemovedObservable onMaterialRemovedObservable onMeshImportedObservable onMeshRemovedObservable onMultiMaterialRemovedObservable onNewCameraAddedObservable onNewGeometryAddedObservable onNewLightAddedObservable onNewMaterialAddedObservable onNewMeshAddedObservable onNewMultiMaterialAddedObservable onNewSkeletonAddedObservable onNewTextureAddedObservable onNewTransformNodeAddedObservable onPointerDown? onPointerMove? onPointerObservable onPointerPick? onPointerUp? onPreKeyboardObservable onPrePointerObservable onReadyObservable onScenePerformancePriorityChangedObservable onSkeletonRemovedObservable onTextureRemovedObservable onTransformNodeRemovedObservable particleSystems particlesEnabled physicsEnabled pointerMoveTrianglePredicate postProcessManager postProcessRenderPipelineManager postProcesses postProcessesEnabled prePassRenderer preventDefaultOnPointerDown preventDefaultOnPointerUp probesEnabled proceduralTexturesEnabled renderTargetsEnabled requireLightSorting reservedDataStore rootNodes skeletons soundTracks sounds spriteManagers? spritesEnabled subSurfaceConfiguration textures transformNodes useConstantAnimationDeltaTime useDelayedTextureLoading FOGMODE_EXP FOGMODE_EXP2 FOGMODE_LINEAR FOGMODE_NONE MaxDeltaTime MinDeltaTime

Accessors

Methods

addActionManager addAnimation addAnimationGroup addCamera addEffectLayer addExternalData addGeometry addLight addMaterial addMesh addMorphTargetManager addMultiMaterial addParticleSystem addPendingData addSkeleton addTexture addTransformNode animate attachControl beginAnimation beginDirectAnimation beginDirectHierarchyAnimation beginHierarchyAnimation beginWeightedAnimation bindEyePosition cleanCachedTextureBuffer clearCachedVertexData createDefaultCamera createDefaultCameraOrLight createDefaultEnvironment createDefaultLight createDefaultSkybox createDefaultVRExperience createDefaultXRExperienceAsync createPickingRay createPickingRayInCameraSpace createPickingRayInCameraSpaceToRef createPickingRayToRef createSceneUniformBuffer deleteCompoundImpostor detachControl disableDepthRenderer disablePhysicsEngine disablePrePassRenderer disableSubSurfaceForPrePass dispose enableDepthRenderer enablePhysics enablePrePassRenderer enableSubSurfaceForPrePass executeOnceBeforeRender executeWhenReady finalizeSceneUbo freeActiveMeshes freeProcessedMaterials freeRenderingGroups freezeActiveMeshes freezeMaterials getActiveBones getActiveIndices getActiveMeshes getActiveParticles getAllAnimatablesByTarget getAnimatableByTarget getAnimationGroupByName getAnimationRatio getAutoClearDepthStencilSetup getBoneByID getBoneById getBoneByName getBoundingBoxRenderer getCachedEffect getCachedMaterial getCachedVisibility getCameraByID getCameraById getCameraByName getCameraByUniqueID getCameraByUniqueId getCamerasByTags getClassName getEngine getExternalData getFrameId getGeometries getGeometryByID getGeometryById getGlowLayerByName getHighlightLayerByName getInternalStep getLastEntryByID getLastEntryById getLastMaterialByID getLastMaterialById getLastMeshByID getLastMeshById getLastSkeletonByID getLastSkeletonById getLastTransformNodeById getLightByID getLightById getLightByName getLightByUniqueID getLightByUniqueId getLightsByTags getMaterialByID getMaterialById getMaterialByName getMaterialByTags getMaterialByUniqueID getMeshByID getMeshById getMeshByName getMeshByUniqueID getMeshByUniqueId getMeshesByID getMeshesById getMeshesByTags getMorphTargetById getMorphTargetByName getMorphTargetManagerById getNodeByID getNodeById getNodeByName getNodes getOrAddExternalDataWithFactory getParticleSystemByID getParticleSystemById getPerfCollector getPhysicsEngine getPointerOverMesh getPointerOverSprite getPostProcessByName getProjectionMatrix getRenderId getSceneUniformBuffer getSkeletonById getSkeletonByName getSkeletonByUniqueId getSoundByName getStepId getTextureByName getTextureByUniqueID getTextureByUniqueId getTotalVertices getTransformMatrix getTransformNodeByID getTransformNodeById getTransformNodeByName getTransformNodeByUniqueID getTransformNodeByUniqueId getTransformNodesByID getTransformNodesById getTransformNodesByTags getUniqueId getViewMatrix getWaitingItemsCount getWorldExtends incrementRenderId isActiveMesh isCachedMaterialInvalid isPhysicsEnabled isPointerCaptured isReady markAllMaterialsAsDirty multiPick multiPickSprite multiPickSpriteWithRay multiPickWithRay pick pickSprite pickSpriteWithRay pickWithBoundingInfo pickWithRay pushGeometry registerAfterRender registerBeforeRender removeActionManager removeAnimation removeAnimationGroup removeCamera removeEffectLayer removeExternalData removeGeometry removeLight removeMaterial removeMesh removeMorphTargetManager removeMultiMaterial removeParticleSystem removePendingData removeSkeleton removeTexture removeTransformNode render resetCachedMaterial resetDrawCache resetLastAnimationTimeFrame setActiveCameraByID setActiveCameraById setActiveCameraByName setDefaultCandidateProviders setPointerOverMesh setPointerOverSprite setRenderingAutoClearDepthStencil setRenderingOrder setSceneUniformBuffer setStepId setTransformMatrix simulatePointerDown simulatePointerMove simulatePointerUp sortActiveAnimatables sortLightsByPriority stopAllAnimations stopAnimation switchActiveCamera unfreezeActiveMeshes unfreezeMaterials unregisterAfterRender unregisterBeforeRender updateTransformMatrix whenReadyAsync AddIndividualParser AddParser CollisionCoordinatorFactory DefaultMaterialFactory GetIndividualParser GetParser Parse

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: BabylonAnimation[]

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

    • (mesh: AbstractMesh, camera: Camera): Nullable<AbstractMesh>
    • Gets or sets a user defined funtion to select LOD from a mesh and a camera. By default this function is undefined and Babylon.js will select LOD based on distance to camera

      Parameters

      Returns Nullable<AbstractMesh>

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

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.

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.

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

Type declaration

    • (): ISmartArrayLike<AbstractMesh>
    • Lambda returning the list of potentially active meshes.

      Returns ISmartArrayLike<AbstractMesh>

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

Type declaration

    • (mesh: AbstractMesh): ISmartArrayLike<SubMesh>
    • Lambda returning the list of potentially active sub meshes.

      Parameters

      Returns ISmartArrayLike<SubMesh>

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

Type declaration

    • (mesh: AbstractMesh, collider: Collider): ISmartArrayLike<SubMesh>
    • Lambda returning the list of potentially colliding sub meshes.

      Parameters

      Returns ISmartArrayLike<SubMesh>

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

    • (mesh: AbstractMesh, localRay: Ray): ISmartArrayLike<SubMesh>
    • Lambda returning the list of potentially intersecting sub meshes.

      Parameters

      Returns ISmartArrayLike<SubMesh>

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

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

    • (evt: IPointerEvent, pickInfo: PickingInfo, type: PointerEventTypes): void
    • Callback called when a pointer down is detected

      Parameters

      • evt: IPointerEvent
      • pickInfo: PickingInfo
      • type: PointerEventTypes

      Returns void

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

Type declaration

    • (evt: IPointerEvent, pickInfo: PickingInfo, type: PointerEventTypes): void
    • Callback called when a pointer move is detected

      Parameters

      • evt: IPointerEvent
      • pickInfo: PickingInfo
      • type: PointerEventTypes

      Returns void

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

    • (evt: IPointerEvent, pickInfo: PickingInfo): void
    • Callback called when a pointer pick is detected

      Parameters

      • evt: IPointerEvent
      • pickInfo: PickingInfo

      Returns void

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

Type declaration

    • (evt: IPointerEvent, pickInfo: Nullable<PickingInfo>, type: PointerEventTypes): void
    • Callback called when a pointer up is detected

      Parameters

      • evt: IPointerEvent
      • pickInfo: Nullable<PickingInfo>
      • type: PointerEventTypes

      Returns void

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

proceduralTexturesEnabled: boolean

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

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)

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

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

  • get activeCamera(): Nullable<Camera>
  • Gets or sets the current active camera

    Returns Nullable<Camera>

  • set activeCamera(value: Nullable<Camera>): void
  • Parameters

    • value: Nullable<Camera>

    Returns void

  • get activeCameras(): Nullable<Camera[]>
  • All of the active cameras added to this scene.

    Returns Nullable<Camera[]>

  • set activeCameras(cameras: Nullable<Camera[]>): void
  • Parameters

    • cameras: Nullable<Camera[]>

    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

    • callback: Nullable<(() => void)>

    Returns void

  • get animatables(): Animatable[]
  • Gets all animatable attached to the scene

    Returns Animatable[]

  • get animationPropertiesOverride(): Nullable<AnimationPropertiesOverride>
  • Gets or sets the animation properties override

    Returns Nullable<AnimationPropertiesOverride>

  • set animationPropertiesOverride(value: Nullable<AnimationPropertiesOverride>): void
  • Parameters

    • value: Nullable<AnimationPropertiesOverride>

    Returns void

  • 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

    • callback: Nullable<(() => void)>

    Returns void

  • get blockMaterialDirtyMechanism(): 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)

    Returns boolean

  • set blockMaterialDirtyMechanism(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

  • get blockfreeActiveMeshesAndRenderingGroups(): 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.

    Returns boolean

  • set blockfreeActiveMeshesAndRenderingGroups(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

  • get defaultMaterial(): Material
  • The default material used on meshes when no material is affected

    Returns Material

  • set defaultMaterial(value: Material): void
  • The default material used on meshes when no material is affected

    Parameters

    Returns void

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

    Returns Nullable<BaseTexture>

  • set environmentTexture(value: Nullable<BaseTexture>): void
  • Texture used in all pbr material as the reflection texture. As in the majority of the scene they are the same (exception for multi room and so on), this is easier to set here than in all the materials.

    Parameters

    • value: Nullable<BaseTexture>

    Returns void

  • get forcePointsCloud(): boolean
  • Returns boolean

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

    Parameters

    • value: boolean

    Returns void

  • get forceWireframe(): boolean
  • Returns boolean

  • set forceWireframe(value: boolean): void
  • 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[]

  • get imageProcessingConfiguration(): ImageProcessingConfiguration
  • 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
  • Returns boolean

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

    Parameters

    • value: boolean

    Returns void

  • get meshUnderPointer(): Nullable<AbstractMesh>
  • 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

  • get performancePriority(): ScenePerformancePriority
  • Gets or sets a value indicating how to treat performance relatively to ease of use and backward compatibility

    Returns ScenePerformancePriority

  • set performancePriority(value: ScenePerformancePriority): void
  • Parameters

    • value: ScenePerformancePriority

    Returns void

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

    Returns boolean

  • set pointerDownFastCheck(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

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

    Returns ((Mesh: AbstractMesh) => boolean)

      • (Mesh: AbstractMesh): boolean
      • Gets or sets a predicate used to select candidate meshes for a pointer down event

        Parameters

        Returns boolean

  • set pointerDownPredicate(value: ((Mesh: AbstractMesh) => boolean)): void
  • Parameters

    Returns void

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

    Returns boolean

  • set pointerMoveFastCheck(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

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

    Returns ((Mesh: AbstractMesh) => boolean)

      • (Mesh: AbstractMesh): boolean
      • Gets or sets a predicate used to select candidate meshes for a pointer move event

        Parameters

        Returns boolean

  • set pointerMovePredicate(value: ((Mesh: AbstractMesh) => boolean)): void
  • Parameters

    Returns void

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

    Returns boolean

  • set pointerUpFastCheck(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

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

    Returns ((Mesh: AbstractMesh) => boolean)

      • (Mesh: AbstractMesh): boolean
      • Gets or sets a predicate used to select candidate meshes for a pointer up event

        Parameters

        Returns boolean

  • set pointerUpPredicate(value: ((Mesh: AbstractMesh) => boolean)): void
  • Parameters

    Returns void

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

    Returns number

  • set pointerX(value: number): void
  • Parameters

    • value: number

    Returns void

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

    Returns number

  • set pointerY(value: number): void
  • Parameters

    • value: number

    Returns void

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

    Returns boolean

  • get renderingManager(): RenderingManager
  • Gets the scene's rendering manager

    Returns RenderingManager

  • get shadowsEnabled(): boolean
  • Returns boolean

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

    Parameters

    • value: boolean

    Returns void

  • get skeletonsEnabled(): boolean
  • Returns boolean

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

    Parameters

    • value: boolean

    Returns void

  • get skipFrustumClipping(): boolean
  • Returns 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

    Parameters

    • value: boolean

    Returns void

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

    Returns boolean

  • set skipPointerDownPicking(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

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

    Returns boolean

  • set skipPointerMovePicking(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

  • get skipPointerUpPicking(): 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.

    Returns boolean

  • set skipPointerUpPicking(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

  • get texturesEnabled(): boolean
  • Returns boolean

  • set texturesEnabled(value: boolean): void
  • 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

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

    Returns Vector2

  • get useRightHandedSystem(): boolean
  • Returns boolean

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

    Parameters

    • value: boolean

    Returns void

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

    Returns number

  • set DoubleClickDelay(value: number): void
  • Parameters

    • value: number

    Returns void

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

    Returns number

  • set DragMovementThreshold(value: number): void
  • Parameters

    • value: number

    Returns void

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

    Returns boolean

  • set ExclusiveDoubleClickMode(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

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

    Returns number

  • set LongPressDelay(value: number): void
  • Parameters

    • value: number

    Returns void

Methods

  • Adds the given action manager to this scene

    Deprecated

    Parameters

    • newActionManager: AbstractActionManager

      The action manager to add

    Returns void

  • Adds the given animation to this scene

    Parameters

    Returns void

  • Adds the given animation group to this scene.

    Parameters

    • newAnimationGroup: AnimationGroup

      The animation group to add

    Returns 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

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

    Returns

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

    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

  • Adds the given geometry to this scene

    Parameters

    • newGeometry: Geometry

      The geometry to add

    Returns void

  • Adds the given light to this scene

    Parameters

    • newLight: Light

      The light to add

    Returns 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

    • newMorphTargetManager: MorphTargetManager

      The morph target to add

    Returns void

  • Adds the given multi-material to this scene

    Parameters

    • newMultiMaterial: MultiMaterial

      The multi-material to add

    Returns void

  • Adds the given particle system to this scene

    Parameters

    • newParticleSystem: IParticleSystem

      The particle system to add

    Returns 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

  • Adds the given skeleton to this scene

    Parameters

    • newSkeleton: Skeleton

      The skeleton to add

    Returns void

  • Adds the given texture to this scene.

    Parameters

    • newTexture: BaseTexture

      The texture to add

    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

  • Execute all animations (for a frame)

    Returns 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

  • Will start the animation sequence of a given target

    Returns

    the animatable object created for this animation

    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

  • Begin a new animation on a given node

    Returns

    the list of created animatables

    Parameters

    • target: any

      defines the target where the animation will take place

    • animations: BabylonAnimation[]

      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

  • Begin a new animation on a given node and its hierarchy

    Returns

    the list of animatables created for all nodes

    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: BabylonAnimation[]

      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[]

  • Will start the animation sequence of a given target and its hierarchy

    Returns

    the list of created animatables

    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[]

  • Will start the animation sequence of a given target

    Returns

    the animatable object created for this animation

    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

  • Bind the current view position to an effect.

    Returns

    the computed eye position

    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

  • 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

  • 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

  • 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

  • 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

  • Creates a new sky box

    See

    https://doc.babylonjs.com/features/featuresDeepDive/scene/fastBuildWorld#create-default-skybox

    Returns

    a new mesh holding the sky box

    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>

  • Creates a new VREXperienceHelper

    See

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

    Deprecated

    Please use createDefaultXRExperienceAsync instead

    Returns

    a new VREXperienceHelper

    Parameters

    • Optional webVROptions: VRExperienceHelperOptions

      defines the options used to create the new VREXperienceHelper

    Returns VRExperienceHelper

  • Creates a new WebXRDefaultExperience

    See

    https://doc.babylonjs.com/features/featuresDeepDive/webXR/introToWebXR

    Returns

    a promise for a new WebXRDefaultExperience

    Parameters

    • Optional options: WebXRDefaultExperienceOptions

      experience options

    Returns Promise<WebXRDefaultExperience>

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

    Returns

    a Ray

    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

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

    Returns

    a Ray

    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

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

    Returns

    the current 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

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

    Returns

    the current 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

  • Creates a scene UBO

    Returns

    a new ubo

    Parameters

    • Optional name: string

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

    Returns UniformBuffer

  • Deletes a physics compound impostor

    Parameters

    • compound: any

      defines the compound to delete

    Returns 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

  • Disables and disposes the physics engine associated with the scene

    Returns void

  • Disables the prepass associated with the scene

    Returns void

  • Disables the subsurface effect for prepass

    Returns void

  • Releases all held resources

    Returns void

  • Creates a depth renderer a given camera which contains a depth map which can be used for post processing.

    Returns

    the created depth renderer

    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

  • Enables physics to the current scene

    Returns

    a boolean indicating if the physics engine was initialized

    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

  • Enables the prepass and associates it with the scene

    Returns

    the PrePassRenderer

    Returns Nullable<PrePassRenderer>

  • Enables the subsurface effect for prepass

    Returns

    the SubSurfaceConfiguration

    Returns Nullable<SubSurfaceConfiguration>

  • 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

  • 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

    the scene UniformBuffer

    Returns UniformBuffer

  • Clear the active meshes smart array preventing retention point in mesh dispose.

    Returns void

  • Clear the processed materials smart array preventing retention point in material dispose.

    Returns void

  • Clear the info related to rendering groups preventing retention points during dispose.

    Returns void

  • Use this function to stop evaluating active meshes. The current list will be keep alive between frames

    Returns

    the current scene

    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

  • 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

  • Gets the total number of active bones rendered per frame

    Returns

    the total number of active bones rendered per frame

    Returns 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

    the total number of active indices rendered per frame

    Returns number

  • Gets the array of active meshes

    Returns

    an array of AbstractMesh

    Returns SmartArray<AbstractMesh>

  • Gets the total number of active particles rendered per frame

    Returns

    the total number of active particles rendered per frame

    Returns number

  • Gets all animatables associated with a given target

    Returns

    an array of Animatables

    Parameters

    • target: any

      defines the target to look animatables for

    Returns Animatable[]

  • Gets the animatable associated with a specific target

    Returns

    the required animatable if found

    Parameters

    • target: any

      defines the target of the animatable

    Returns Nullable<Animatable>

  • get an animation group using its name

    Returns

    the animation group or null if none found.

    Parameters

    • name: string

      defines the material's name

    Returns Nullable<AnimationGroup>

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

    Returns

    a number

    Returns number

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

    Returns

    The auto clear setup for the requested rendering group

    Parameters

    • index: number

      the rendering group index to get the information for

    Returns IRenderingManagerAutoClearSetup

  • Gets a bone using its Id

    Returns

    the bone or null if not found

    Deprecated

    Please use getBoneById instead

    Parameters

    • id: string

      defines the bone's Id

    Returns Nullable<Bone>

  • Gets a bone using its Id

    Returns

    the bone or null if not found

    Parameters

    • id: string

      defines the bone's Id

    Returns Nullable<Bone>

  • Gets a bone using its id

    Returns

    the bone or null if not found

    Parameters

    • name: string

      defines the bone's name

    Returns Nullable<Bone>

  • Gets the bounding box renderer associated with the scene

    Returns

    a BoundingBoxRenderer

    Returns BoundingBoxRenderer

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

    Returns

    the cached effect

    Returns Nullable<Effect>

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

    Returns

    the cached material

    Returns Nullable<Material>

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

    Returns

    the cached visibility state

    Returns Nullable<number>

  • Gets a camera using its Id

    Returns

    the camera or null if not found

    Deprecated

    Please use getCameraById instead

    Parameters

    • id: string

      defines the Id to look for

    Returns Nullable<Camera>

  • Gets a camera using its Id

    Returns

    the camera or null if not found

    Parameters

    • id: string

      defines the Id to look for

    Returns Nullable<Camera>

  • Gets a camera using its name

    Returns

    the camera or null if none found.

    Parameters

    • name: string

      defines the camera's name

    Returns Nullable<Camera>

  • Gets a camera using its unique Id

    Returns

    the camera or null if not found

    Deprecated

    Please use getCameraByUniqueId instead

    Parameters

    • uniqueId: number

      defines the unique Id to look for

    Returns Nullable<Camera>

  • Gets a camera using its unique Id

    Returns

    the camera or null if not found

    Parameters

    • uniqueId: number

      defines the unique Id to look for

    Returns Nullable<Camera>

  • Get a list of cameras by tags

    Returns

    an array of Camera

    Parameters

    • tagsQuery: string

      defines the tags query to use

    • Optional filter: ((camera: Camera) => boolean)

      defines a predicate used to filter results

        • (camera: Camera): boolean
        • Parameters

          • camera: Camera

          Returns boolean

    Returns Camera[]

  • Gets a string identifying the name of the class

    Returns

    "Scene" string

    Returns string

  • Gets the engine associated with the scene

    Returns

    an Engine

    Returns Engine

  • Get an externally attached data from its key

    Returns

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

    Type Parameters

    • T

    Parameters

    • key: string

      the unique key that identifies the data

    Returns Nullable<T>

  • Gets an unique Id for the current frame

    Returns

    a number

    Returns number

  • Gets the list of geometries attached to the scene

    Returns

    an array of Geometry

    Returns Geometry[]

  • Gets a geometry using its Id

    Returns

    the geometry or null if none found.

    Deprecated

    Please use getGeometryById instead

    Parameters

    • id: string

      defines the geometry's Id

    Returns Nullable<Geometry>

  • Gets a geometry using its Id

    Returns

    the geometry or null if none found.

    Parameters

    • id: string

      defines the geometry's Id

    Returns Nullable<Geometry>

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

    Returns

    The glow layer if found otherwise null.

    Parameters

    • name: string

      The name of the glow layer to look for.

    Returns Nullable<GlowLayer>

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

    Returns

    The highlight layer if found otherwise null.

    Parameters

    • name: string

      The name of the highlight layer to look for.

    Returns Nullable<HighlightLayer>

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

    Returns

    the found node or null if not found at all

    Deprecated

    Please use getLastEntryById instead

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<Node>

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

    Returns

    the found node or null if not found at all

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<Node>

  • Gets a the last added material using a given id

    Returns

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

    Deprecated

    Please use getLastMaterialById instead

    Parameters

    • id: string

      defines the material's Id

    Returns Nullable<Material>

  • Gets a last added material using a given id

    Returns

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

    Parameters

    • id: string

      defines the material's id

    • Optional allowMultiMaterials: boolean

      determines whether multimaterials should be considered

    Returns Nullable<Material>

  • Gets a the last added mesh using a given Id

    Returns

    the found mesh or null if not found at all.

    Deprecated

    Please use getLastMeshById instead

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<AbstractMesh>

  • Gets a the last added mesh using a given Id

    Returns

    the found mesh or null if not found at all.

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<AbstractMesh>

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

    Returns

    the found skeleton or null if not found at all.

    Deprecated

    Please use getLastSkeletonById instead

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<Skeleton>

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

    Returns

    the found skeleton or null if not found at all.

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<Skeleton>

  • Gets a the last transform node using a given Id

    Returns

    the found mesh or null if not found at all.

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<TransformNode>

  • Gets a light node using its Id

    Returns

    the light or null if none found.

    Deprecated

    Please use getLightById instead

    Parameters

    • id: string

      defines the light's Id

    Returns Nullable<Light>

  • Gets a light node using its Id

    Returns

    the light or null if none found.

    Parameters

    • id: string

      defines the light's Id

    Returns Nullable<Light>

  • Gets a light node using its name

    Returns

    the light or null if none found.

    Parameters

    • name: string

      defines the the light's name

    Returns Nullable<Light>

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

    Returns

    the light or null if none found.

    Deprecated

    Please use getLightByUniqueId instead

    Parameters

    • uniqueId: number

      defines the light's unique Id

    Returns Nullable<Light>

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

    Returns

    the light or null if none found.

    Parameters

    • uniqueId: number

      defines the light's unique Id

    Returns Nullable<Light>

  • Get a list of lights by tags

    Returns

    an array of Light

    Parameters

    • tagsQuery: string

      defines the tags query to use

    • Optional filter: ((light: Light) => boolean)

      defines a predicate used to filter results

        • (light: Light): boolean
        • Parameters

          • light: Light

          Returns boolean

    Returns Light[]

  • Get a material using its id

    Returns

    the material or null if none found.

    Deprecated

    Please use getMaterialById instead

    Parameters

    • id: string

      defines the material's Id

    Returns Nullable<Material>

  • get a material using its id

    Returns

    the material or null if none found.

    Parameters

    • id: string

      defines the material's Id

    • Optional allowMultiMaterials: boolean

      determines whether multimaterials should be considered

    Returns Nullable<Material>

  • Gets a material using its name

    Returns

    the material or null if none found.

    Parameters

    • name: string

      defines the material's name

    • Optional allowMultiMaterials: boolean

      determines whether multimaterials should be considered

    Returns Nullable<Material>

  • Get a list of materials by tags

    Returns

    an array of Material

    Parameters

    • tagsQuery: string

      defines the tags query to use

    • Optional filter: ((material: Material) => boolean)

      defines a predicate used to filter results

    Returns Material[]

  • Get a material using its unique id

    Returns

    the material or null if none found.

    Parameters

    • uniqueId: number

      defines the material's unique id

    • Optional allowMultiMaterials: boolean

      determines whether multimaterials should be considered

    Returns Nullable<Material>

  • Gets the first added mesh found of a given Id

    Returns

    the mesh found or null if not found at all

    Deprecated

    Please use getMeshById instead

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<AbstractMesh>

  • Gets the first added mesh found of a given Id

    Returns

    the mesh found or null if not found at all

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<AbstractMesh>

  • Gets a mesh using a given name

    Returns

    the found mesh or null if not found at all.

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<AbstractMesh>

  • Gets a mesh with its auto-generated unique Id

    Returns

    the found mesh or null if not found at all.

    Deprecated

    Please use getMeshByUniqueId instead

    Parameters

    • uniqueId: number

      defines the unique Id to search for

    Returns Nullable<AbstractMesh>

  • Gets a mesh with its auto-generated unique Id

    Returns

    the found mesh or null if not found at all.

    Parameters

    • uniqueId: number

      defines the unique Id to search for

    Returns Nullable<AbstractMesh>

  • Gets a list of meshes using their Id

    Returns

    a list of meshes

    Deprecated

    Please use getMeshesById instead

    Parameters

    • id: string

      defines the Id to search for

    Returns AbstractMesh[]

  • Gets a list of meshes using their Id

    Returns

    a list of meshes

    Parameters

    • id: string

      defines the Id to search for

    Returns AbstractMesh[]

  • Get a list of meshes by tags

    Returns

    an array of Mesh

    Parameters

    • tagsQuery: string

      defines the tags query to use

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

      defines a predicate used to filter results

    Returns Mesh[]

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

    Returns

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

    Parameters

    • id: string

      defines the id to search for

    Returns Nullable<MorphTarget>

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

    Returns

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

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<MorphTarget>

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

    Returns

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

    Parameters

    • id: number

      defines the id to search for

    Returns Nullable<MorphTargetManager>

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

    Returns

    the found node or null if not found at all

    Deprecated

    Please use getNodeById instead

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<Node>

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

    Returns

    the found node or null if not found at all

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<Node>

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

    Returns

    the found node or null if not found at all.

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<Node>

  • Returns

    all meshes, lights, cameras, transformNodes and bones

    Returns Node[]

  • Get an externally attached data from its key, create it using a factory if it's not already present

    Returns

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

    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

  • Gets a particle system by Id

    Returns

    the corresponding system or null if none found

    Deprecated

    Please use getParticleSystemById instead

    Parameters

    • id: string

      defines the particle system Id

    Returns Nullable<IParticleSystem>

  • Gets a particle system by Id

    Returns

    the corresponding system or null if none found

    Parameters

    • id: string

      defines the particle system Id

    Returns Nullable<IParticleSystem>

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

    Returns

    the perf collector belonging to the scene.

    Returns PerformanceViewerCollector

  • Gets the current physics engine

    Returns

    a IPhysicsEngine or null if none attached

    Returns Nullable<IPhysicsEngine>

  • Gets the mesh under the pointer

    Returns

    a Mesh or null if no mesh is under the pointer

    Returns Nullable<AbstractMesh>

  • Gets the sprite under the pointer

    Returns

    a Sprite or null if no sprite is under the pointer

    Returns Nullable<Sprite>

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

    Returns

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

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<PostProcess>

  • Gets the current projection matrix

    Returns

    a Matrix

    Returns Matrix

  • Gets an unique Id for the current render phase

    Returns

    a number

    Returns number

  • Gets the uniform buffer used to store scene data

    Returns

    a UniformBuffer

    Returns UniformBuffer

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

    Returns

    the found skeleton or null if not found at all.

    Parameters

    • id: string

      defines the id to search for

    Returns Nullable<Skeleton>

  • Gets a skeleton using a given name

    Returns

    the found skeleton or null if not found at all.

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<Skeleton>

  • Gets a skeleton using a given auto generated unique id

    Returns

    the found skeleton or null if not found at all.

    Parameters

    • uniqueId: number

      defines the unique id to search for

    Returns Nullable<Skeleton>

  • Gets a sound using a given name

    Returns

    the found sound or null if not found at all.

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<Sound>

  • Gets a texture using its name

    Returns

    the texture or null if none found.

    Parameters

    • name: string

      defines the texture's name

    Returns Nullable<BaseTexture>

  • Get a texture using its unique id

    Returns

    the texture or null if none found.

    Deprecated

    Please use getTextureByUniqueId instead

    Parameters

    • uniqueId: number

      defines the texture's unique id

    Returns Nullable<BaseTexture>

  • Get a texture using its unique id

    Returns

    the texture or null if none found.

    Parameters

    • uniqueId: number

      defines the texture's unique id

    Returns Nullable<BaseTexture>

  • Gets the total number of vertices rendered per frame

    Returns

    the total number of vertices rendered per frame

    Returns number

  • Gets the current transform matrix

    Returns

    a Matrix made of View * Projection

    Returns Matrix

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

    Returns

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

    Deprecated

    Please use getTransformNodeById instead

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<TransformNode>

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

    Returns

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

    Parameters

    • id: string

      defines the Id to search for

    Returns Nullable<TransformNode>

  • Gets a transform node using a given name

    Returns

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

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<TransformNode>

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

    Returns

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

    Deprecated

    Please use getTransformNodeByUniqueId instead

    Parameters

    • uniqueId: number

      defines the unique Id to search for

    Returns Nullable<TransformNode>

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

    Returns

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

    Parameters

    • uniqueId: number

      defines the unique Id to search for

    Returns Nullable<TransformNode>

  • Gets a list of transform nodes using their Id

    Returns

    a list of transform nodes

    Deprecated

    Please use getTransformNodesById instead

    Parameters

    • id: string

      defines the Id to search for

    Returns TransformNode[]

  • Gets a list of transform nodes using their Id

    Returns

    a list of transform nodes

    Parameters

    • id: string

      defines the Id to search for

    Returns TransformNode[]

  • Get a list of transform nodes by tags

    Returns

    an array of TransformNode

    Parameters

    • tagsQuery: string

      defines the tags query to use

    • Optional filter: ((transform: TransformNode) => boolean)

      defines a predicate used to filter results

    Returns TransformNode[]

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

    Returns

    an unique number for the scene

    Returns number

  • Gets the current view matrix

    Returns

    a Matrix

    Returns Matrix

  • Returns the number of items waiting to be loaded

    Returns

    the number of items waiting to be loaded

    Returns number

  • Get the world extend vectors with an optional filter

    Returns

    min and max vectors

    Parameters

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

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

    Returns { max: Vector3; min: Vector3 }

  • Call this function if you want to manually increment the render Id

    Returns void

  • Gets a boolean indicating if the given mesh is active

    Returns

    true if the mesh is in the active list

    Parameters

    Returns boolean

  • Gets a boolean indicating if the current material / effect / visibility must be bind again

    Returns

    true if one parameter is not cached

    Parameters

    • material: Material

      defines the current material

    • effect: Effect

      defines the current effect

    • Optional visibility: number

      defines the current visibility state

    Returns boolean

  • Gets a boolean indicating if there is an active physics engine

    Returns

    a boolean indicating if there is an active physics engine

    Returns boolean

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

    Returns

    true if the pointer was captured

    Parameters

    • Optional pointerId: number

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

    Returns 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

    Returns

    true if all required resources are ready

    Parameters

    • Optional checkRenderTargets: boolean

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

    Returns boolean

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

    Returns

    an array of PickingInfo

    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[]>

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

    Returns

    a PickingInfo array

    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

        • (sprite: Sprite): boolean
        • Parameters

          • sprite: Sprite

          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[]>

  • Use the given ray to pick sprites in the scene

    Returns

    a PickingInfo array

    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

        • (sprite: Sprite): boolean
        • Parameters

          • sprite: Sprite

          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[]>

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

    Returns

    an array of PickingInfo

    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[]>

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

    Returns

    a PickingInfo

    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

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

    Returns

    a PickingInfo

    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

        • (sprite: Sprite): boolean
        • Parameters

          • sprite: Sprite

          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>

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

    Returns

    a PickingInfo

    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

        • (sprite: Sprite): boolean
        • Parameters

          • sprite: Sprite

          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>

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

    Returns

    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)

    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>

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

    Returns

    a PickingInfo

    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>

  • Add a new geometry to this scene

    Returns

    a boolean defining if the geometry was added or not

    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

  • Registers a function to be called after every frame render

    Parameters

    • func: (() => void)

      defines the function to register

        • (): void
        • Returns void

    Returns 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

    Returns

    The index of the removed action manager

    Parameters

    • toRemove: AbstractActionManager

      The action manager to remove

    Returns number

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

    Returns

    the index where the animation was in the animation list

    Parameters

    Returns number

  • Removes the given animation group from this scene.

    Returns

    The index of the removed animation group

    Parameters

    • toRemove: AnimationGroup

      The animation group to remove

    Returns number

  • Remove a camera for the list of scene's cameras

    Returns

    the index where the camera was in the camera list

    Parameters

    • toRemove: Camera

      defines the camera to remove

    Returns number

  • Removes the given effect layer from this scene.

    Returns

    the index of the removed effect layer

    Parameters

    • toRemove: EffectLayer

      defines the effect layer to remove

    Returns number

  • Remove an externally attached data from the Engine instance

    Returns

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

    Parameters

    • key: string

      the unique key that identifies the data

    Returns boolean

  • Removes an existing geometry

    Returns

    a boolean defining if the geometry was removed or not

    Parameters

    • geometry: Geometry

      defines the geometry to be removed from the scene

    Returns boolean

  • Remove a light for the list of scene's lights

    Returns

    the index where the light was in the light list

    Parameters

    • toRemove: Light

      defines the light to remove

    Returns number

  • Removes the given material from this scene.

    Returns

    The index of the removed material

    Parameters

    • toRemove: Material

      The material to remove

    Returns number

  • Remove a mesh for the list of scene's meshes

    Returns

    the index where the mesh was in the mesh list

    Parameters

    • toRemove: AbstractMesh

      defines the mesh to remove

    • Optional recursive: boolean

      if all child meshes should also be removed from the scene

    Returns number

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

    Returns

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

    Parameters

    • toRemove: MorphTargetManager

      defines the morph target to remove

    Returns number

  • Removes the given multi-material from this scene.

    Returns

    The index of the removed multi-material

    Parameters

    • toRemove: MultiMaterial

      The multi-material to remove

    Returns number

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

    Returns

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

    Parameters

    • toRemove: IParticleSystem

      defines the particle system to remove

    Returns number

  • 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

  • Remove a skeleton for the list of scene's skeletons

    Returns

    the index where the skeleton was in the skeleton list

    Parameters

    • toRemove: Skeleton

      defines the skeleton to remove

    Returns number

  • Removes the given texture from this scene.

    Returns

    The index of the removed texture

    Parameters

    • toRemove: BaseTexture

      The texture to remove

    Returns number

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

    Returns

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

    Parameters

    Returns number

  • 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

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

    Returns 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

  • 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

    Returns

    the new active camera or null if none found.

    Deprecated

    Please use setActiveCameraById instead

    Parameters

    • id: string

      defines the camera's Id

    Returns Nullable<Camera>

  • sets the active camera of the scene using its Id

    Returns

    the new active camera or null if none found.

    Parameters

    • id: string

      defines the camera's Id

    Returns Nullable<Camera>

  • sets the active camera of the scene using its name

    Returns

    the new active camera or null if none found.

    Parameters

    • name: string

      defines the camera's name

    Returns Nullable<Camera>

  • 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

    • sprite: Nullable<Sprite>

      defines the sprite to use

    Returns 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

    • ubo: UniformBuffer

      the ubo to set for the scene

    Returns 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

  • Use this method to simulate a pointer down on a mesh The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay

    Returns

    the current scene

    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

  • Use this method to simulate a pointer move on a mesh The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay

    Returns

    the current scene

    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

  • Use this method to simulate a pointer up on a mesh The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay

    Returns

    the current scene

    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

  • Sort active animatables based on their playOrder property

    Returns void

  • Sorts the list list based on light priorities

    Returns void

  • Stops and removes all animations that have been applied to the scene

    Returns 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

  • 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