Scene

Represents a scene to be rendered by the engine.

see

http://doc.babylonjs.com/features/scene

Hierarchy

  • Scene

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

  • Creates a new Scene

    Parameters

    • engine: Engine

      defines the engine to use to render this scene

    Returns Scene

Properties

VRHelper

Gets or sets the VRExperienceHelper attached to the scene

see

http://doc.babylonjs.com/how_to/webvr_helper

ignorenaming

actionManager

actionManager: ActionManager

Gets or sets the action manager associated with the scene

see

http://doc.babylonjs.com/how_to/how_to_use_actions

activeBonesPerfCounter

activeBonesPerfCounter: PerfCounter

Gets the performance counter for active bones

see

http://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation

activeCamera

activeCamera: Nullable<Camera>

The current active camera

activeCameras

activeCameras: Camera[]

All of the active cameras added to this scene.

activeParticlesPerfCounter

activeParticlesPerfCounter: PerfCounter

Gets the performance counter for active particles

see

http://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation

afterCameraRender

afterCameraRender: function

Sets a function to be executed after rendering a camera

Type declaration

    • (): void
    • Returns void

afterRender

afterRender: Nullable<function>

Sets a function to be executed after rendering this scene

ambientColor

ambientColor: Color3

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

animatables

animatables: Animatable[]

Gets all animatable attached to the scene

animationGroups

animationGroups: AnimationGroup[]

All of the animation groups added to this scene

see

http://doc.babylonjs.com/how_to/group

animationPropertiesOverride

animationPropertiesOverride: Nullable<AnimationPropertiesOverride>

Gets or sets the animation properties override

animationTimeScale

animationTimeScale: number

Gets or sets a general scale for animation speed

see

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

animations

animations: Animation[]

Gets a list of Animations associated with the scene

animationsEnabled

animationsEnabled: boolean

Gets or sets a boolean indicating if animations are enabled

audioEnabled

audioEnabled: boolean

Gets or sets if audio support is enabled

see

http://doc.babylonjs.com/how_to/playing_sounds_and_music

autoClear

autoClear: boolean

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

autoClearDepthAndStencil

autoClearDepthAndStencil: boolean

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

beforeCameraRender

beforeCameraRender: function

Sets a function to be executed before rendering a camera

Type declaration

    • (): void
    • Returns void

beforeRender

beforeRender: Nullable<function>

Sets a function to be executed before rendering this scene

cameraToUseForPointers

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

cameras: Camera[]

All of the cameras added to this scene.

see

http://doc.babylonjs.com/babylon101/cameras

clearColor

clearColor: Color4

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

clipPlane

clipPlane: Nullable<Plane>

Gets or sets the active clipplane

collisionsEnabled

collisionsEnabled: boolean

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

see

http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity

constantlyUpdateMeshUnderPointer

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

customRenderTargets

customRenderTargets: RenderTargetTexture[]

The list of user defined render targets added to the scene

debugLayer

debugLayer: DebugLayer

Gets the debug layer associated with the scene

see

http://doc.babylonjs.com/features/playground_debuglayer

defaultCursor

defaultCursor: string

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

defaultMaterial

defaultMaterial: Material

The default material used on meshes when no material is affected

disableOfflineSupportExceptionRules

disableOfflineSupportExceptionRules: RegExp[]

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

dispatchAllSubMeshesOfActiveMeshes

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)

dumpNextRenderTargets

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

effectLayers: EffectLayer[]

The list of effect layers (highlights/glow) added to the scene

see

http://doc.babylonjs.com/how_to/highlight_layer

see

http://doc.babylonjs.com/how_to/glow_layer

environmentTexture

environmentTexture: BaseTexture

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

fogColor

fogColor: Color3

Gets or sets the fog color to use

see

http://doc.babylonjs.com/babylon101/environment#fog

fogDensity

fogDensity: number

Gets or sets the fog density to use

see

http://doc.babylonjs.com/babylon101/environment#fog

fogEnabled

fogEnabled: boolean

Gets or sets a boolean indicating if fog is enabled on this scene

see

http://doc.babylonjs.com/babylon101/environment#fog

fogEnd

fogEnd: number

Gets or sets the fog end distance to use

see

http://doc.babylonjs.com/babylon101/environment#fog

fogMode

fogMode: number

Gets or sets the fog mode to use

see

http://doc.babylonjs.com/babylon101/environment#fog

fogStart

fogStart: number

Gets or sets the fog start distance to use

see

http://doc.babylonjs.com/babylon101/environment#fog

forcePointsCloud

forcePointsCloud: boolean

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

forceShowBoundingBoxes

forceShowBoundingBoxes: boolean

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

forceWireframe

forceWireframe: boolean

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

frustumPlanes

frustumPlanes: Plane[]

Gets the list of frustum planes (built from the active camera)

gamepadManager

gamepadManager: GamepadManager

Gets the gamepad manager associated with the scene

see

http://doc.babylonjs.com/how_to/how_to_use_gamepads

geometryBufferRenderer

geometryBufferRenderer: Nullable<GeometryBufferRenderer>

Sets the current geometry buffer for the scene.

gravity

gravity: Vector3

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

see

http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity

headphone

headphone: boolean

Gets or sets if audio will be output to headphones

see

http://doc.babylonjs.com/how_to/playing_sounds_and_music

hoverCursor

hoverCursor: string

Defines the HTML cursor to use when hovering over interactive elements

imageProcessingConfiguration

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.

importedMeshesFiles

importedMeshesFiles: String[]

Gets the list of meshes imported to the scene through SceneLoader

isDisposed

isDisposed: boolean

Gets if the scene is already disposed

isLoading

isLoading: boolean

Returns a boolean indicating if the scene is still loading data

layers

layers: Layer[]

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

lensFlareSystems

lensFlareSystems: LensFlareSystem[]

The list of lens flare system added to the scene

see

http://doc.babylonjs.com/how_to/how_to_use_lens_flares

lensFlaresEnabled

lensFlaresEnabled: boolean

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

lights

lights: Light[]

All of the lights added to this scene

see

http://doc.babylonjs.com/babylon101/lights

lightsEnabled

lightsEnabled: boolean

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

loadingPluginName

loadingPluginName: string

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

mainSoundTrack

mainSoundTrack: SoundTrack

Gets the main soundtrack associated with the scene

materials

materials: Material[]

All of the materials added to this scene

see

http://doc.babylonjs.com/babylon101/materials

meshUnderPointer

meshUnderPointer: Nullable<AbstractMesh>

Gets the mesh that is currently under the pointer

meshes

meshes: AbstractMesh[]

All of the (abstract) meshes added to this scene

metadata

metadata: any

Gets or sets user defined metadata

morphTargetManagers

morphTargetManagers: MorphTargetManager[]

The list of morph target managers added to the scene

see

http://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh

multiMaterials

multiMaterials: MultiMaterial[]

All of the multi-materials added to this scene

see

http://doc.babylonjs.com/how_to/multi_materials

onAfterActiveMeshesEvaluationObservable

onAfterActiveMeshesEvaluationObservable: Observable<Scene>

An event triggered when active meshes evaluation is done

onAfterAnimationsObservable

onAfterAnimationsObservable: Observable<Scene>

An event triggered after animations processing

onAfterCameraRenderObservable

onAfterCameraRenderObservable: Observable<Camera>

An event triggered after rendering a camera

onAfterDrawPhaseObservable

onAfterDrawPhaseObservable: Observable<Scene>

An event triggered after draw calls have been sent

onAfterParticlesRenderingObservable

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

onAfterPhysicsObservable: Observable<Scene>

An event triggered when physic simulation has been done

onAfterRenderObservable

onAfterRenderObservable: Observable<Scene>

An event triggered after rendering the scene

onAfterRenderTargetsRenderObservable

onAfterRenderTargetsRenderObservable: Observable<Scene>

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

onAfterSpritesRenderingObservable

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

onAfterStepObservable: Observable<Scene>

An event triggered after calculating deterministic simulation step

onBeforeActiveMeshesEvaluationObservable

onBeforeActiveMeshesEvaluationObservable: Observable<Scene>

An event triggered when active meshes evaluation is about to start

onBeforeAnimationsObservable

onBeforeAnimationsObservable: Observable<Scene>

An event triggered before animating the scene

onBeforeCameraRenderObservable

onBeforeCameraRenderObservable: Observable<Camera>

An event triggered before rendering a camera

onBeforeDrawPhaseObservable

onBeforeDrawPhaseObservable: Observable<Scene>

An event triggered before draw calls are ready to be sent

onBeforeParticlesRenderingObservable

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

onBeforePhysicsObservable: Observable<Scene>

An event triggered when physic simulation is about to be run

onBeforeRenderObservable

onBeforeRenderObservable: Observable<Scene>

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

onBeforeRenderTargetsRenderObservable

onBeforeRenderTargetsRenderObservable: Observable<Scene>

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

onBeforeSpritesRenderingObservable

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

onBeforeStepObservable: Observable<Scene>

An event triggered before calculating deterministic simulation step

onCameraRemovedObservable

onCameraRemovedObservable: Observable<Camera>

An event triggered when a camera is removed

onDataLoadedObservable

onDataLoadedObservable: Observable<Scene>

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

onDispose

onDispose: function

Sets a function to be executed when this scene is disposed.

Type declaration

    • (): void
    • Returns void

onDisposeObservable

onDisposeObservable: Observable<Scene>

An event triggered when the scene is disposed.

onGeometryRemovedObservable

onGeometryRemovedObservable: Observable<Geometry>

An event triggered when a geometry is removed

onKeyboardObservable

onKeyboardObservable: Observable<KeyboardInfo>

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

onLightRemovedObservable

onLightRemovedObservable: Observable<Light>

An event triggered when a light is removed

onMeshRemovedObservable

onMeshRemovedObservable: Observable<AbstractMesh>

An event triggered when a mesh is removed

onNewCameraAddedObservable

onNewCameraAddedObservable: Observable<Camera>

An event triggered when a camera is created

onNewGeometryAddedObservable

onNewGeometryAddedObservable: Observable<Geometry>

An event triggered when a geometry is created

onNewLightAddedObservable

onNewLightAddedObservable: Observable<Light>

An event triggered when a light is created

onNewMeshAddedObservable

onNewMeshAddedObservable: Observable<AbstractMesh>

An event triggered when a mesh is created

onNewTransformNodeAddedObservable

onNewTransformNodeAddedObservable: Observable<TransformNode>

An event triggered when a transform node is created

onPointerDown

onPointerDown: function

Deprecated. Use onPointerObservable instead

Type declaration

onPointerMove

onPointerMove: function

Deprecated. Use onPointerObservable instead

Type declaration

onPointerObservable

onPointerObservable: Observable<PointerInfo>

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

onPointerPick

onPointerPick: function

Deprecated. Use onPointerObservable instead

Type declaration

    • Parameters

      Returns void

onPointerUp

onPointerUp: function

Deprecated. Use onPointerObservable instead

Type declaration

onPreKeyboardObservable

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

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

onReadyObservable: Observable<Scene>

An event triggered when the scene is ready

onRenderingGroupObservable

onRenderingGroupObservable: Observable<RenderingGroupInfo>

This Observable will be triggered for each stage of each renderingGroup of each rendered camera. The RenderinGroupInfo 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)

onTransformNodeRemovedObservable

onTransformNodeRemovedObservable: Observable<TransformNode>

An event triggered when a transform node is removed

particleSystems

particleSystems: IParticleSystem[]

All of the particle systems added to this scene

see

http://doc.babylonjs.com/babylon101/particles

particlesEnabled

particlesEnabled: boolean

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

pointerDownPredicate

pointerDownPredicate: function

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

Type declaration

pointerMovePredicate

pointerMovePredicate: function

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

Type declaration

pointerUpPredicate

pointerUpPredicate: function

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

Type declaration

pointerX

pointerX: number

Gets the current on-screen X position of the pointer

pointerY

pointerY: number

Gets the current on-screen Y position of the pointer

postProcessManager

postProcessManager: PostProcessManager

Gets the current postprocess manager

postProcessRenderPipelineManager

postProcessRenderPipelineManager: PostProcessRenderPipelineManager

postProcesses

postProcesses: PostProcess[]

The list of postprocesses added to the scene

postProcessesEnabled

postProcessesEnabled: boolean

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

preventDefaultOnPointerDown

preventDefaultOnPointerDown: boolean

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

probesEnabled

probesEnabled: boolean

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

proceduralTextures

proceduralTextures: ProceduralTexture[]

The list of procedural textures added to the scene

see

http://doc.babylonjs.com/how_to/how_to_use_procedural_textures

proceduralTexturesEnabled

proceduralTexturesEnabled: boolean

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

reflectionProbes

reflectionProbes: ReflectionProbe[]

The list of reflection probes added to the scene

see

http://doc.babylonjs.com/how_to/how_to_use_reflection_probes

renderTargetsEnabled

renderTargetsEnabled: boolean

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

requireLightSorting

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

selectionOctree

selectionOctree: Octree<AbstractMesh>

Gets the octree used to boost mesh selection (picking)

see

http://doc.babylonjs.com/how_to/optimizing_your_scene_with_octrees

shadowsEnabled

shadowsEnabled: boolean

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

simplificationQueue

simplificationQueue: SimplificationQueue

Gets or sets the simplification queue attached to the scene

see

http://doc.babylonjs.com/how_to/in-browser_mesh_simplification

skeletons

skeletons: Skeleton[]

The list of skeletons added to the scene

see

http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons

skeletonsEnabled

skeletonsEnabled: boolean

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

soundTracks

soundTracks: SoundTrack[]

The list of sound tracks added to the scene

see

http://doc.babylonjs.com/how_to/playing_sounds_and_music

spriteManagers

spriteManagers: SpriteManager[]

All of the sprite managers added to this scene

see

http://doc.babylonjs.com/babylon101/sprites

spritesEnabled

spritesEnabled: boolean

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

textures

textures: BaseTexture[]

All of the textures added to this scene

texturesEnabled

texturesEnabled: boolean

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

totalActiveIndicesPerfCounter

totalActiveIndicesPerfCounter: PerfCounter

Gets the performance counter for active indices

see

http://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation

totalVerticesPerfCounter

totalVerticesPerfCounter: PerfCounter

Gets the performance counter for total vertices

see

http://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation

transformNodes

transformNodes: TransformNode[]

All of the tranform nodes added to this scene

see

http://doc.babylonjs.com/how_to/transformnode

uid

uid: string

Return a unique id as a string which can serve as an identifier for the scene

unTranslatedPointer

unTranslatedPointer: Vector2

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

useConstantAnimationDeltaTime

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

useDelayedTextureLoading: boolean

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

useRightHandedSystem

useRightHandedSystem: boolean

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

workerCollisions

workerCollisions: boolean

Static DoubleClickDelay

DoubleClickDelay: number

Time in milliseconds with two consecutive clicks will be considered as a double click

Static DragMovementThreshold

DragMovementThreshold: number

The distance in pixel that you have to move to prevent some events

Static ExclusiveDoubleClickMode

ExclusiveDoubleClickMode: boolean

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

Static FOGMODE_EXP

FOGMODE_EXP: number

The fog density is following an exponential function

Static FOGMODE_EXP2

FOGMODE_EXP2: number

The fog density is following an exponential function faster than FOGMODE_EXP

Static FOGMODE_LINEAR

FOGMODE_LINEAR: number

The fog density is following a linear function.

Static FOGMODE_NONE

FOGMODE_NONE: number

The fog is deactivated

Static LongPressDelay

LongPressDelay: number

Time in milliseconds to wait to raise long press events if button is still pressed

Static MaxDeltaTime

MaxDeltaTime: number

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

see

http://doc.babylonjs.com/babylon101/animations#deterministic-lockstep

Static MinDeltaTime

MinDeltaTime: number

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

see

http://doc.babylonjs.com/babylon101/animations#deterministic-lockstep

Methods

addActionManager

  • Adds the given action manager to this scene

    Parameters

    Returns void

addAnimation

  • addAnimation(newAnimation: Animation): void
  • Adds the given animation to this scene

    Parameters

    • newAnimation: Animation

      The animation to add

    Returns void

addAnimationGroup

  • Adds the given animation group to this scene.

    Parameters

    Returns void

addCamera

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

    Parameters

    • newCamera: Camera

      The camera to add

    Returns void

addEffectLayer

  • Adds the given effect layer to this scene

    Parameters

    • newEffectLayer: EffectLayer

      defines the effect layer to add

    Returns void

addExternalData

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

    Type parameters

    • T

    Parameters

    • key: string

      the unique key that identifies the data

    • data: T

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

    Returns boolean

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

addGeometry

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

    Parameters

    • newGeometry: Geometry

      The geometry to add

    Returns void

addLensFlareSystem

  • Adds the given lens flare system to this scene

    Parameters

    Returns void

addLight

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

    Parameters

    • newLight: Light

      The light to add

    Returns void

addMaterial

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

    Parameters

    • newMaterial: Material

      The material to add

    Returns void

addMesh

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

    Parameters

    Returns void

addMorphTargetManager

  • Adds the given morph target to this scene

    Parameters

    Returns void

addMultiMaterial

  • Adds the given multi-material to this scene

    Parameters

    Returns void

addParticleSystem

  • Adds the given particle system to this scene

    Parameters

    Returns void

addSkeleton

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

    Parameters

    • newSkeleton: Skeleton

      The skeleton to add

    Returns void

addTexture

  • Adds the given texture to this scene.

    Parameters

    Returns void

addTransformNode

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

    Parameters

    • newTransformNode: TransformNode

      defines the transform node to add

    Returns void

attachControl

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

    Parameters

    • Optional attachUp: boolean

      defines if you want to attach events to pointerup

    • Optional attachDown: boolean

      defines if you want to attach events to pointerdown

    • Optional attachMove: boolean

      defines if you want to attach events to pointermove

    Returns void

beginAnimation

  • beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: function, animatable?: Animatable, stopCurrent?: boolean): Animatable
  • Will start the animation sequence of a given target

    Parameters

    • target: any

      defines the target

    • from: number

      defines from which frame should animation start

    • to: number

      defines until which frame should animation run.

    • Optional loop: boolean

      defines if the animation loops

    • Optional speedRatio: number

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

    • Optional onAnimationEnd: function

      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)

    Returns Animatable

    the animatable object created for this animation

beginDirectAnimation

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

    Parameters

    • target: any

      defines the target where the animation will take place

    • animations: Animation[]

      defines the list of animations to start

    • from: number

      defines the initial value

    • to: number

      defines the final value

    • Optional loop: boolean

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

    • Optional speedRatio: number

      defines the speed ratio to apply to all animations

    • Optional onAnimationEnd: function

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

        • (): void
        • Returns void

    Returns Animatable

    the list of created animatables

beginDirectHierarchyAnimation

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

    Parameters

    • target: Node

      defines the root node where the animation will take place

    • directDescendantsOnly: boolean

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

    • animations: Animation[]

      defines the list of animations to start

    • from: number

      defines the initial value

    • to: number

      defines the final value

    • Optional loop: boolean

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

    • Optional speedRatio: number

      defines the speed ratio to apply to all animations

    • Optional onAnimationEnd: function

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

        • (): void
        • Returns void

    Returns Animatable[]

    the list of animatables created for all nodes

beginWeightedAnimation

  • beginWeightedAnimation(target: any, from: number, to: number, weight?: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: function, animatable?: Animatable): Animatable
  • Will start the animation sequence of a given target

    Parameters

    • target: any

      defines the target

    • from: number

      defines from which frame should animation start

    • to: number

      defines until which frame should animation run.

    • Optional 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: function

      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

    Returns Animatable

    the animatable object created for this animation

createDefaultCamera

  • createDefaultCamera(createArcRotateCamera?: boolean, replace?: boolean, attachCameraControls?: boolean): void
  • Creates a default camera for the scene.

    Parameters

    • Optional createArcRotateCamera: boolean

      Whether to create an arc rotate or a free camera.

    • Optional replace: boolean

      Whether to replace the existing active camera in the scene.

    • Optional attachCameraControls: boolean

      Whether to attach camera controls to the canvas.

    Returns void

createDefaultCameraOrLight

  • createDefaultCameraOrLight(createArcRotateCamera?: boolean, replace?: boolean, attachCameraControls?: boolean): void
  • Creates a default camera and a default light

    Parameters

    • Optional createArcRotateCamera: boolean

      defines that the camera will be an ArcRotateCamera

    • Optional replace: boolean

      defines if the camera and/or light will replace the existing ones

    • Optional attachCameraControls: boolean

      defines if attachControl will be called on the new camera

    Returns void

createDefaultEnvironment

createDefaultLight

  • createDefaultLight(replace?: boolean): void
  • Creates a default light for the scene.

    Parameters

    • Optional replace: boolean

      Whether to replace the existing lights in the scene.

    Returns void

createDefaultSkybox

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

    • Optional environmentTexture: BaseTexture

      defines the texture to use as environment texture

    • Optional pbr: boolean

      defines if PBRMaterial must be used instead of StandardMaterial

    • Optional scale: number

      defines the overall scale of the skybox

    • Optional blur: number

      defines if blurring must be applied to the environment texture (works only with pbr === true)

    Returns Nullable<Mesh>

    a new mesh holding the sky box

createDefaultVRExperience

createOrUpdateSelectionOctree

  • createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree<AbstractMesh>

createPickingRay

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

    Parameters

    • x: number

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

    • y: number

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

    • world: Matrix

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

    • camera: Nullable<Camera>

      defines the camera to use for the picking

    • Optional cameraViewSpace: boolean

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

    Returns Ray

    a Ray

createPickingRayInCameraSpace

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

    Parameters

    • x: number

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

    • y: number

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

    • Optional camera: Camera

      defines the camera to use for the picking

    Returns Ray

    a Ray

createPickingRayInCameraSpaceToRef

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

    Parameters

    • x: number

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

    • y: number

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

    • result: Ray

      defines the ray where to store the picking ray

    • Optional camera: Camera

      defines the camera to use for the picking

    Returns Scene

    the current scene

createPickingRayToRef

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

    Parameters

    • x: number

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

    • y: number

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

    • world: 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)

    Returns Scene

    the current scene

deleteCompoundImpostor

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

    Parameters

    • compound: any

      defines the compound to delete

    Returns void

detachControl

  • detachControl(): void
  • Detaches all event handlers

    Returns void

disableDepthRenderer

  • 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

disableGeometryBufferRenderer

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

    Returns void

disablePhysicsEngine

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

    Returns void

dispose

  • dispose(): void
  • Releases all held ressources

    Returns void

disposeSounds

  • disposeSounds(): void
  • Releases sounds & soundtracks

    Returns void

enableDepthRenderer

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

    Parameters

    • Optional camera: Nullable<Camera>

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

    Returns DepthRenderer

    the created depth renderer

enableGeometryBufferRenderer

  • Enables a GeometryBufferRender and associates it with the scene

    Parameters

    • Optional ratio: number

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

    Returns Nullable<GeometryBufferRenderer>

    the GeometryBufferRenderer

enablePhysics

  • Enables physics to the current scene

    Parameters

    • Optional gravity: Nullable<Vector3>

      defines the scene's gravity for the physics engine

    • Optional plugin: IPhysicsEnginePlugin

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

    Returns boolean

    a boolean indicating if the physics engine was initialized

executeOnceBeforeRender

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

    Parameters

    • func: function

      The function to be executed.

        • (): void
        • Returns void

    • Optional timeout: number

      optional delay in ms

    Returns void

executeWhenReady

  • executeWhenReady(func: function): void
  • Registers a function to be executed when the scene is ready

    Parameters

    • func: function

      the function to be executed

        • (): void
        • Returns void

    Returns void

freeActiveMeshes

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

    Returns void

freeProcessedMaterials

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

    Returns void

freeRenderingGroups

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

    Returns void

freezeActiveMeshes

  • freezeActiveMeshes(): Scene
  • Use this function to stop evaluating active meshes. The current list will be keep alive between frames

    Returns Scene

    the current scene

freezeMaterials

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

    Returns void

getActiveBones

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

    Returns number

    the total number of active bones rendered per frame

getActiveIndices

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

    Returns number

    the total number of active indices rendered per frame

getActiveMeshCandidateProvider

getActiveMeshes

getActiveParticles

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

    Returns number

    the total number of active particles rendered per frame

getAllAnimatablesByTarget

  • getAllAnimatablesByTarget(target: any): Array<Animatable>
  • Gets all animatables associated with a given target

    Parameters

    • target: any

      defines the target to look animatables for

    Returns Array<Animatable>

    an array of Animatables

getAnimatableByTarget

  • Gets the animatable associated with a specific target

    Parameters

    • target: any

      defines the target of the animatable

    Returns Nullable<Animatable>

    the required animatable if found

getAnimationGroupByName

  • get an animation group using its name

    Parameters

    • name: string

      defines the material's name

    Returns Nullable<AnimationGroup>

    the animation group or null if none found.

getAnimationRatio

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

    Returns number

    a number

getBoneByID

  • Gets a bone using its id

    Parameters

    • id: string

      defines the bone's id

    Returns Nullable<Bone>

    the bone or null if not found

getBoneByName

  • Gets a bone using its id

    Parameters

    • name: string

      defines the bone's name

    Returns Nullable<Bone>

    the bone or null if not found

getBoundingBoxRenderer

  • Gets the bounding box renderer associated with the scene

    Returns BoundingBoxRenderer

    a BoundingBoxRenderer

getCachedEffect

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

    Returns Nullable<Effect>

    the cached effect

getCachedMaterial

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

    Returns Nullable<Material>

    the cached material

getCachedVisibility

  • getCachedVisibility(): Nullable<number>
  • Gets the cached visibility state (ie. the latest rendered one)

    Returns Nullable<number>

    the cached visibility state

getCameraByID

  • Gets a camera using its id

    Parameters

    • id: string

      defines the id to look for

    Returns Nullable<Camera>

    the camera or null if not found

getCameraByName

  • Gets a camera using its name

    Parameters

    • name: string

      defines the camera's name

    Returns Nullable<Camera>

    the camera or null if none found.

getCameraByUniqueID

  • Gets a camera using its unique id

    Parameters

    • uniqueId: number

      defines the unique id to look for

    Returns Nullable<Camera>

    the camera or null if not found

getCamerasByTags

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

    Parameters

    • tagsQuery: string

      defines the tags query to use

    • Optional forEach: function

      defines a predicate used to filter results

        • Parameters

          Returns void

    Returns Camera[]

    an array of Camera

getEngine

  • Gets the engine associated with the scene

    Returns Engine

    an Engine

getExternalData

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

    Type parameters

    • T

    Parameters

    • key: string

      the unique key that identifies the data

    Returns Nullable<T>

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

getGeometries

  • Gets the list of geometries attached to the scene

    Returns Geometry[]

    an array of Geometry

getGeometryByID

  • Gets a geometry using its ID

    Parameters

    • id: string

      defines the geometry's id

    Returns Nullable<Geometry>

    the geometry or null if none found.

getGlowLayerByName

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

    Parameters

    • name: string

      The name of the highlight layer to look for.

    Returns Nullable<GlowLayer>

    The highlight layer if found otherwise null.

getHighlightLayerByName

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

    Parameters

    • name: string

      The name of the highlight layer to look for.

    Returns Nullable<HighlightLayer>

    The highlight layer if found otherwise null.

getInternalStep

  • getInternalStep(): number

getLastEntryByID

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

    Parameters

    • id: string

      defines the id to search for

    Returns Nullable<Node>

    the found node or null if not found at all

getLastMeshByID

  • Gets a the last added mesh using a given id

    Parameters

    • id: string

      defines the id to search for

    Returns Nullable<AbstractMesh>

    the found mesh or null if not found at all.

getLastSkeletonByID

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

    Parameters

    • id: string

      defines the id to search for

    Returns Nullable<Skeleton>

    the found skeleton or null if not found at all.

getLensFlareSystemByID

  • Gets a lens flare system using its id

    Parameters

    • id: string

      defines the id to look for

    Returns Nullable<LensFlareSystem>

    the lens flare system or null if not found

getLensFlareSystemByName

  • Gets a lens flare system using its name

    Parameters

    • name: string

      defines the name to look for

    Returns Nullable<LensFlareSystem>

    the lens flare system or null if not found

getLightByID

  • Gets a light node using its id

    Parameters

    • id: string

      defines the light's id

    Returns Nullable<Light>

    the light or null if none found.

getLightByName

  • Gets a light node using its name

    Parameters

    • name: string

      defines the the light's name

    Returns Nullable<Light>

    the light or null if none found.

getLightByUniqueID

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

    Parameters

    • uniqueId: number

      defines the light's unique id

    Returns Nullable<Light>

    the light or null if none found.

getLightsByTags

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

    Parameters

    • tagsQuery: string

      defines the tags query to use

    • Optional forEach: function

      defines a predicate used to filter results

        • Parameters

          Returns void

    Returns Light[]

    an array of Light

getMaterialByID

  • get a material using its id

    Parameters

    • id: string

      defines the material's ID

    Returns Nullable<Material>

    the material or null if none found.

getMaterialByName

  • Gets a material using its name

    Parameters

    • name: string

      defines the material's name

    Returns Nullable<Material>

    the material or null if none found.

getMaterialByTags

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

    Parameters

    • tagsQuery: string

      defines the tags query to use

    • Optional forEach: function

      defines a predicate used to filter results

    Returns Material[]

    an array of Material

getMeshByID

  • Gets the first added mesh found of a given ID

    Parameters

    • id: string

      defines the id to search for

    Returns Nullable<AbstractMesh>

    the mesh found or null if not found at all

getMeshByName

  • Gets a mesh using a given name

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<AbstractMesh>

    the found mesh or null if not found at all.

getMeshByUniqueID

  • Gets a mesh with its auto-generated unique id

    Parameters

    • uniqueId: number

      defines the unique id to search for

    Returns Nullable<AbstractMesh>

    the found mesh or null if not found at all.

getMeshesByID

  • Gets a list of meshes using their id

    Parameters

    • id: string

      defines the id to search for

    Returns Array<AbstractMesh>

    a list of meshes

getMeshesByTags

  • getMeshesByTags(tagsQuery: string, forEach?: function): Mesh[]
  • Get a list of meshes by tags

    Parameters

    • tagsQuery: string

      defines the tags query to use

    • Optional forEach: function

      defines a predicate used to filter results

    Returns Mesh[]

    an array of Mesh

getMorphTargetManagerById

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

    Parameters

    • id: number

      defines the id to search for

    Returns Nullable<MorphTargetManager>

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

getNodeByID

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

    Parameters

    • id: string

      defines the id to search for

    Returns Nullable<Node>

    the found node or null if not found at all

getNodeByName

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

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<Node>

    the found node or null if not found at all.

getOrAddExternalDataWithFactory

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

    Type parameters

    • T

    Parameters

    • key: string

      the unique key that identifies the data

    • factory: function

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

        • (k: string): T
        • Parameters

          • k: string

          Returns T

    Returns T

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

getOutlineRenderer

  • Gets the outline renderer associated with the scene

    Returns OutlineRenderer

    a OutlineRenderer

getParticleSystemByID

  • Gets a particle system by id

    Parameters

    • id: string

      defines the particle system id

    Returns Nullable<IParticleSystem>

    the corresponding system or null if none found

getPhysicsEngine

  • Gets the current physics engine

    Returns Nullable<PhysicsEngine>

    a PhysicsEngine or null if none attached

getPointerOverMesh

  • Gets the mesh under the pointer

    Returns Nullable<AbstractMesh>

    a Mesh or null if no mesh is under the pointer

getPointerOverSprite

  • Gets the sprite under the pointer

    Returns Nullable<Sprite>

    a Sprite or null if no sprite is under the pointer

getProjectionMatrix

  • getProjectionMatrix(): Matrix
  • Gets the current projection matrix

    Returns Matrix

    a Matrix

getRenderId

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

    Returns number

    a number

getSceneUniformBuffer

  • Gets the uniform buffer used to store scene data

    Returns UniformBuffer

    a UniformBuffer

getSkeletonById

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

    Parameters

    • id: string

      defines the id to search for

    Returns Nullable<Skeleton>

    the found skeleton or null if not found at all.

getSkeletonByName

  • Gets a skeleton using a given name

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<Skeleton>

    the found skeleton or null if not found at all.

getSoundByName

  • Gets a sound using a given name

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<Sound>

    the found sound or null if not found at all.

getStepId

  • getStepId(): number

getTotalVertices

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

    Returns number

    the total number of vertices rendered per frame

getTransformMatrix

  • getTransformMatrix(): Matrix
  • Gets the current transform matrix

    Returns Matrix

    a Matrix made of View * Projection

getTransformNodeByID

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

    Parameters

    • id: string

      defines the id to search for

    Returns Nullable<TransformNode>

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

getTransformNodeByName

  • Gets a transform node using a given name

    Parameters

    • name: string

      defines the name to search for

    Returns Nullable<TransformNode>

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

getTransformNodesByID

  • Gets a list of transform nodes using their id

    Parameters

    • id: string

      defines the id to search for

    Returns Array<TransformNode>

    a list of transform nodes

getUniqueId

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

    Returns number

    an unique number for the scene

getViewMatrix

  • Gets the current view matrix

    Returns Matrix

    a Matrix

getWaitingItemsCount

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

    Returns number

    the number of items waiting to be loaded

getWorldExtends

  • getWorldExtends(filterPredicate?: function): object
  • Get the world extend vectors with an optional filter

    Parameters

    • Optional filterPredicate: function

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

    Returns object

    min and max vectors

incrementRenderId

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

    Returns void

isActiveMesh

  • Gets a boolean indicating if the given mesh is active

    Parameters

    Returns boolean

    true if the mesh is in the active list

isCachedMaterialInvalid

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

    Parameters

    • material: Material

      defines the current material

    • effect: Effect

      defines the current effect

    • Optional visibility: number

      defines the current visibility state

    Returns boolean

    true if one parameter is not cached

isPhysicsEnabled

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

    Returns boolean

    a boolean indicating if there is an active physics engine

isReady

  • isReady(): 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 boolean

    true if all required resources are ready

markAllMaterialsAsDirty

  • markAllMaterialsAsDirty(flag: number, predicate?: function): void
  • Will flag all materials as dirty to trigger new shader compilation

    Parameters

    • flag: number

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

    • Optional predicate: function

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

    Returns void

multiPick

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

    Parameters

    • x: number

      X position on screen

    • y: number

      Y position on screen

    • Optional predicate: function

      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

    Returns Nullable<PickingInfo[]>

    an array of PickingInfo

multiPickWithRay

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

    Parameters

    • ray: Ray

      Ray to use

    • predicate: function

      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

    Returns Nullable<PickingInfo[]>

    an array of PickingInfo

pick

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

    Parameters

    • x: number

      position on screen

    • y: number

      position on screen

    • Optional predicate: function

      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

      Launch a fast check only using the bounding boxes. Can be set to null.

    • Optional camera: Nullable<Camera>

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

    Returns Nullable<PickingInfo>

    a PickingInfo

pickSprite

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

    Parameters

    • x: number

      position on screen

    • y: number

      position on screen

    • Optional predicate: function

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

        • Parameters

          Returns boolean

    • Optional fastCheck: boolean

      Launch a fast check only using the bounding boxes. Can be set to null.

    • Optional camera: Camera

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

    Returns Nullable<PickingInfo>

    a PickingInfo

pickWithRay

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

    Parameters

    • ray: Ray

      The ray to use to pick meshes

    • predicate: function

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

    • Optional fastCheck: boolean

      Launch a fast check only using the bounding boxes. Can be set to null

    Returns Nullable<PickingInfo>

    a PickingInfo

pushGeometry

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

    Parameters

    • geometry: Geometry

      defines the geometry to be added to the scene.

    • Optional force: boolean

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

    Returns boolean

    a boolean defining if the geometry was added or not

registerAfterRender

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

    Parameters

    • func: function

      defines the function to register

        • (): void
        • Returns void

    Returns void

registerBeforeRender

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

    Parameters

    • func: function

      defines the function to register

        • (): void
        • Returns void

    Returns void

removeActionManager

  • Removes the given action manager from this scene.

    Parameters

    Returns number

    The index of the removed action manager

removeAnimation

  • removeAnimation(toRemove: Animation): number
  • Remove a animation for the list of scene's animations

    Parameters

    • toRemove: Animation

      defines the animation to remove

    Returns number

    the index where the animation was in the animation list

removeAnimationGroup

  • Removes the given animation group from this scene.

    Parameters

    Returns number

    The index of the removed animation group

removeCamera

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

    Parameters

    • toRemove: Camera

      defines the camera to remove

    Returns number

    the index where the camera was in the camera list

removeEffectLayer

  • Removes the given effect layer from this scene.

    Parameters

    • toRemove: EffectLayer

      defines the effect layer to remove

    Returns number

    the index of the removed effect layer

removeExternalData

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

    Parameters

    • key: string

      the unique key that identifies the data

    Returns boolean

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

removeGeometry

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

    Parameters

    • geometry: Geometry

      defines the geometry to be removed from the scene

    Returns boolean

    a boolean defining if the geometry was removed or not

removeLensFlareSystem

  • Removes the given lens flare system from this scene.

    Parameters

    Returns number

    The index of the removed lens flare system

removeLight

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

    Parameters

    • toRemove: Light

      defines the light to remove

    Returns number

    the index where the light was in the light list

removeMaterial

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

    Parameters

    • toRemove: Material

      The material to remove

    Returns number

    The index of the removed material

removeMesh

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

    Parameters

    Returns number

    the index where the mesh was in the mesh list

removeMorphTargetManager

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

    Parameters

    Returns number

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

removeMultiMaterial

  • Removes the given multi-material from this scene.

    Parameters

    Returns number

    The index of the removed multi-material

removeParticleSystem

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

    Parameters

    Returns number

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

removeSkeleton

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

    Parameters

    • toRemove: Skeleton

      defines the skeleton to remove

    Returns number

    the index where the skeleton was in the skeleton list

removeTexture

  • Removes the given texture from this scene.

    Parameters

    Returns number

    The index of the removed texture

removeTransformNode

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

    Parameters

    Returns number

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

render

  • render(): void
  • Render the scene

    Returns void

resetCachedMaterial

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

    Returns void

setActiveCameraByID

  • sets the active camera of the scene using its ID

    Parameters

    • id: string

      defines the camera's ID

    Returns Nullable<Camera>

    the new active camera or null if none found.

setActiveCameraByName

  • sets the active camera of the scene using its name

    Parameters

    • name: string

      defines the camera's name

    Returns Nullable<Camera>

    the new active camera or null if none found.

setActiveMeshCandidateProvider

  • Defines the current active mesh candidate provider

    Parameters

    Returns void

setPointerOverMesh

  • Force the value of meshUnderPointer

    Parameters

    Returns void

setPointerOverSprite

  • Force the sprite under the pointer

    Parameters

    Returns void

setRenderingAutoClearDepthStencil

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

    Parameters

    • renderingGroupId: number

      The rendering group id corresponding to its index

    • autoClearDepthStencil: boolean

      Automatically clears depth and stencil between groups if true.

    • Optional depth: boolean

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

    • Optional stencil: boolean

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

    Returns void

setRenderingOrder

  • setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: Nullable<function>, alphaTestSortCompareFn?: Nullable<function>, transparentSortCompareFn?: Nullable<function>): void
  • Overrides the default sort function applied in the renderging 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<function>

      The opaque queue comparison function use to sort.

    • Optional alphaTestSortCompareFn: Nullable<function>

      The alpha test queue comparison function use to sort.

    • Optional transparentSortCompareFn: Nullable<function>

      The transparent queue comparison function use to sort.

    Returns void

setStepId

  • setStepId(newStepId: number): void

setTransformMatrix

  • setTransformMatrix(view: Matrix, projection: Matrix): void
  • Sets the current transform matrix

    Parameters

    • view: Matrix

      defines the View matrix to use

    • projection: Matrix

      defines the Projection matrix to use

    Returns void

simulatePointerDown

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

    Parameters

    • pickResult: PickingInfo

      pickingInfo of the object wished to simulate pointer event on

    • Optional pointerEventInit: PointerEventInit

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

    Returns Scene

    the current scene

simulatePointerMove

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

    Parameters

    • pickResult: PickingInfo

      pickingInfo of the object wished to simulate pointer event on

    • Optional pointerEventInit: PointerEventInit

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

    Returns Scene

    the current scene

simulatePointerUp

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

    Parameters

    • pickResult: PickingInfo

      pickingInfo of the object wished to simulate pointer event on

    • Optional pointerEventInit: PointerEventInit

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

    Returns Scene

    the current scene

sortLightsByPriority

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

    Returns void

stopAllAnimations

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

    Returns void

stopAnimation

  • stopAnimation(target: any, animationName?: string): 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 empty)

    Returns void

switchActiveCamera

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

    Parameters

    • newCamera: Camera

      defines the new active camera

    • Optional attachControl: boolean

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

    Returns void

unfreezeActiveMeshes

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

    Returns Scene

    the current scene

unfreezeMaterials

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

    Returns void

unregisterAfterRender

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

    Parameters

    • func: function

      defines the function to unregister

        • (): void
        • Returns void

    Returns void

unregisterBeforeRender

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

    Parameters

    • func: function

      defines the function to unregister

        • (): void
        • Returns void

    Returns void

updateAlternateTransformMatrix

  • updateAlternateTransformMatrix(alternateCamera: Camera): void
  • Defines an alternate camera (used mostly in VR-like scenario where two cameras can render the same scene from a slightly different point of view)

    Parameters

    • alternateCamera: Camera

      defines the camera to use

    Returns void

updateTransformMatrix

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

    Parameters

    • Optional force: boolean

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

    Returns void

whenReadyAsync

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

    Returns Promise<void>

    A promise that resolves when the scene is ready

Generated using TypeDoc