API

Class InstancedLinesMesh

Creates an instance based on a source LinesMesh

Hierarchy (View Summary)

Index
addBehavior addChild addRotation alignWithNormal applyAngularImpulse applyImpulse applyTorque attachToBone beginAnimation buildBoundingInfo calcMovePOV calcRotatePOV clone computeWorldMatrix createAnimationRange createInstance createNormals createOrUpdateSubmeshesOctree deleteAnimationRange detachFromBone disableEdgesRendering disableFacetData dispose enableEdgesRendering freezeWorldMatrix getAbsolutePivotPoint getAbsolutePivotPointToRef getAbsolutePosition getAnimationByName getAnimationRange getAnimationRanges getBehaviorByName getBoundingInfo getChildMeshes getChildren getChildTransformNodes getClassName getClosestFacetAtCoordinates getClosestFacetAtLocalCoordinates getConnectedParticleSystems getDescendants getDirection getDirectionToRef getDistanceToCamera getEngine getFacetDataParameters getFacetLocalNormals getFacetLocalPartitioning getFacetLocalPositions getFacetNormal getFacetNormalToRef getFacetPosition getFacetPositionToRef getFacetsAtLocalCoordinates getHierarchyBoundingVectors getIndices getLOD getMaterialForRenderPass getMeshUniformBuffer getNormalsData getPhysicsBody getPhysicsImpostor getPivotMatrix getPivotPoint getPivotPointToRef getPoseMatrix getPositionData getPositionExpressedInLocalSpace getPositionInCameraSpace getRawBoundingInfo getScene getTotalIndices getTotalVertices getVerticesData instantiateHierarchy intersects intersectsMesh intersectsPoint isCompletelyInFrustum isDescendantOf isDisposed isEnabled isInFrustum isReady isUsingPivotMatrix isUsingPostMultiplyPivotMatrix isVerticesDataPresent isWorldMatrixCameraDependent locallyTranslate lookAt markAsDirty movePOV moveWithCollisions normalizeToUnitCube optimizeIndicesAsync registerAfterWorldMatrixUpdate releaseSubMeshes removeBehavior removeChild resetDrawCache resetLocalMatrix rotate rotateAround rotatePOV serialize serializeAnimationRanges setAbsolutePosition setBoundingInfo setDirection setEnabled setIndices setMaterialForRenderPass setParent setPhysicsLinkWith setPivotMatrix setPivotPoint setPositionWithLocalVector setPreTransformMatrix setVerticesData toString transferToEffect translate unfreezeWorldMatrix unregisterAfterWorldMatrixUpdate updateFacetData updateIndices updatePoseMatrix updateVerticesData AddNodeConstructor Construct ParseAnimationRanges
actionManager: Nullable<AbstractActionManager> = null

Gets or sets the current action manager

alphaIndex: number = Number.MAX_VALUE

Gets or sets the alpha index used to sort transparent meshes

alwaysSelectAsActiveMesh: boolean = false

True if the mesh must be rendered in any case (this will shortcut the frustum clipping phase)

animations: Animation[] = []

Gets a list of Animations associated with the node

cullingStrategy: number = AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY

The culling strategy to use to check whether the mesh must be rendered or not. This value can be changed at any time and will be used on the next render mesh selection. The possible values are :

  • AbstractMesh.CULLINGSTRATEGY_STANDARD
  • AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY
  • AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION
  • AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY Please read each static variable documentation to get details about the culling process.
customMarkAsDirty: () => void

Allow user to specify custom mechanism for mark as dirty

Gets or sets the decal map for this mesh

definedFacingForward: boolean = true

Gets or sets the orientation for POV movement & rotation

doNotSyncBoundingInfo: boolean = false

Gets or sets a boolean indicating that the bounding info does not need to be kept in sync (for performance reason)

edgesColor: Color4 = ...

Defines edge color used when edgesRenderer is enabled

edgesRenderer: Nullable<EdgesRenderer>

Gets the edgesRenderer associated with the mesh

edgesWidth: number = 1

Defines edge width used when edgesRenderer is enabled

ellipsoid: Vector3 = ...

Gets or sets the ellipsoid used to impersonate this mesh when using collision engine (default is (0.5, 1, 0.5))

ellipsoidOffset: Vector3 = ...

Gets or sets the ellipsoid offset used to impersonate this mesh when using collision engine (default is (0, 0, 0))

enablePointerMoveEvents: boolean = false

Gets or sets a boolean indicating that pointer move events must be supported on this mesh (false by default)

forceRenderingWhenOccluded: boolean

Flag to force rendering the mesh even if occluded

id: string

Gets or sets the id of the node

ignoreNonUniformScaling: boolean = false

Gets or sets a boolean indicating that non uniform scaling (when at least one component is different from others) should be ignored. By default the system will update normals to compensate

inspectableCustomProperties: IInspectable[]

List of inspectable custom properties (used by the Inspector)

instancedBuffers: { [key: string]: any }

Object used to store instanced buffers defined by user

intersectionThreshold: number

The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray. This margin is expressed in world space coordinates, so its value may vary. Initialized with the intersectionThreshold value of the source LinesMesh

isBlocker: boolean = false

Gets or sets a boolean indicating if the mesh must be considered as a ray blocker for lens flares (false by default)

isNearGrabbable: boolean = false

Gets or sets a boolean indicating if the mesh can be grabbed. Default is false. Setting this to true, while using the XR near interaction feature, will trigger a pointer event when the mesh is grabbed. Grabbing means that the controller is using the squeeze or main trigger button to grab the mesh. This is different from nearPickable which only triggers the event when the mesh is touched by the controller

isNearPickable: boolean = false

Gets or sets a boolean indicating if the mesh can be near picked (touched by the XR controller or hands). Default is false

isOccluded: boolean

Gets or sets whether the mesh is occluded or not, it is used also to set the initial state of the mesh to be occluded or not

isOcclusionQueryInProgress: boolean

Flag to check the progress status of the query

isPickable: boolean = AbstractMesh.DefaultIsPickable

Gets or sets a boolean indicating if the mesh can be picked (by scene.pick for instance or through actions). Default value is determined by AbstractMesh.DefaultIsPickable (true unless changed).

metadata: any = null

Gets or sets an object used to store user defined information for the node

name: string

Gets or sets the name of the node

occlusionForRenderPassId: number

This number indicates the render pass id used to run the occlusion query. The default value is -1, which means run the occlusion query in all render passes.

occlusionQueryAlgorithmType: number

This property determines the type of occlusion query algorithm to run in WebGl, you can use:

  • AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE which is mapped to GL_ANY_SAMPLES_PASSED.
  • AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE (Default Value) which is mapped to GL_ANY_SAMPLES_PASSED_CONSERVATIVE which is a false positive algorithm that is faster than GL_ANY_SAMPLES_PASSED but less accurate.
occlusionRetryCount: number

This number indicates the number of allowed retries before stop the occlusion query, this is useful if the occlusion query is taking long time before to the query result is retrieved, the query result indicates if the object is visible within the scene or not and based on that Babylon.Js engine decides to show or hide the object. The default value is -1 which means don't break the query and wait till the result

occlusionType: number

This property is responsible for starting the occlusion query within the Mesh or not, this property is also used to determine what should happen when the occlusionRetryCount is reached. It has supports 3 values:

  • OCCLUSION_TYPE_NONE (Default Value): this option means no occlusion query within the Mesh.
  • OCCLUSION_TYPE_OPTIMISTIC: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken show the mesh.
  • OCCLUSION_TYPE_STRICT: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken restore the last state of the mesh occlusion if the mesh was visible then show the mesh if was hidden then hide don't show.
onAccessibilityTagChangedObservable: Observable<Nullable<IAccessibilityTag>> = ...

Observable fired when an accessibility tag is changed

onAfterWorldMatrixUpdateObservable: Observable<TransformNode> = ...

An event triggered after the world matrix is updated

onCollideObservable: Observable<AbstractMesh> = ...

An event triggered when this mesh collides with another one

onCollisionPositionChangeObservable: Observable<Vector3> = ...

An event triggered when the collision's position changes

onDisposeObservable: Observable<Node> = ...

An event triggered when the mesh is disposed

onMaterialChangedObservable: Observable<AbstractMesh> = ...

An event triggered when material is changed

onReady: Nullable<(node: Node) => void> = null

Callback raised when the node is ready to be used

onRebuildObservable: Observable<AbstractMesh> = ...

An event triggered when the mesh is rebuilt.

outlineColor: Color3 = ...

Defines color to use when rendering outline

outlineWidth: number = 0.02

Define width to use when rendering outline

overlayAlpha: number = 0.5

Defines alpha to use when rendering overlay

overlayColor: Color3 = ...

Defines color to use when rendering overlay

physicsBody: Nullable<PhysicsBody>

Gets or sets the physics body associated with this node.

physicsImpostor: Nullable<PhysicsImpostor>

Gets or sets impostor used for physic simulation

reIntegrateRotationIntoRotationQuaternion: boolean = false

Gets or sets a boolean indicating that even if rotationQuaternion is defined, you can keep updating rotation property and Babylon.js will just mix both

renderOutline: boolean

Gets or sets a boolean indicating if the outline must be rendered as well

renderOverlay: boolean

Gets or sets a boolean indicating if the overlay must be rendered as well

reservedDataStore: any = null

For internal use only. Please do not use.

scalingDeterminant: number = 1

Multiplication factor on scale x/y/z when computing the world matrix. Eg. for a 1x1x1 cube setting this to 2 will make it a 2x2x2 cube

showBoundingBox: boolean

Gets or sets a boolean indicating if the bounding box must be rendered as well (false by default)

showSubMeshesBoundingBox: boolean = false

Gets or sets a boolean indicating that bounding boxes of subMeshes must be rendered as well (false by default)

state: string = ""

Gets or sets a string used to store user defined state for the node

subMeshes: SubMesh[]

Gets or sets the list of subMeshes

uniqueId: number

Gets or sets the unique id of the node

useOctreeForCollisions: boolean = true

Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes collision (true by default)

useOctreeForPicking: boolean = true

Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes picking (true by default)

useOctreeForRenderingSelection: boolean = true

Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes selection (true by default)

BillboardUseParentOrientation: boolean = false

Child transform with Billboard flags should or should not apply parent rotation (default if off)

CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY: 1 = Constants.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY

Culling strategy : Bounding Sphere Only. This is an exclusion test. It's faster than the standard strategy because the bounding box is not tested. It's also less accurate than the standard because some not visible objects can still be selected. Test : is the bounding sphere outside the frustum ? If not, then the cullable object is in the frustum.

CULLINGSTRATEGY_OPTIMISTIC_INCLUSION: 2 = Constants.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION

Culling strategy : Optimistic Inclusion. This in an inclusion test first, then the standard exclusion test. This can be faster when a cullable object is expected to be almost always in the camera frustum. This could also be a little slower than the standard test when the tested object center is not the frustum but one of its bounding box vertex is still inside. Anyway, it's as accurate as the standard strategy. Test : Is the cullable object bounding sphere center in the frustum ? If not, apply the default culling strategy.

CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY: 3 = Constants.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY

Culling strategy : Optimistic Inclusion then Bounding Sphere Only. This in an inclusion test first, then the bounding sphere only exclusion test. This can be the fastest test when a cullable object is expected to be almost always in the camera frustum. This could also be a little slower than the BoundingSphereOnly strategy when the tested object center is not in the frustum but its bounding sphere still intersects it. It's less accurate than the standard strategy and as accurate as the BoundingSphereOnly strategy. Test : Is the cullable object bounding sphere center in the frustum ? If not, apply the Bounding Sphere Only strategy. No Bounding Box is tested here.

CULLINGSTRATEGY_STANDARD: 0 = Constants.MESHES_CULLINGSTRATEGY_STANDARD

Default culling strategy : this is an exclusion test and it's the more accurate. Test order : Is the bounding sphere outside the frustum ? If not, are the bounding box vertices outside the frustum ? It not, then the cullable object is in the frustum.

DefaultIsPickable: boolean = true

Gets or sets the default value for isPickable for newly created meshes. When set to false, all meshes created after the change will not be pickable by default. Individual meshes can still override this by setting their own isPickable property.

OCCLUSION_ALGORITHM_TYPE_ACCURATE: number = 0

Use an accurate occlusion algorithm

OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE: number = 1

Use a conservative occlusion algorithm

OCCLUSION_TYPE_NONE: number = 0

No occlusion

OCCLUSION_TYPE_OPTIMISTIC: number = 1

Occlusion set to optimistic

OCCLUSION_TYPE_STRICT: number = 2

Occlusion set to strict

  • get collisionResponse(): boolean

    Gets or sets a collision response flag (default is true). when collisionResponse is false, events are still triggered but colliding entity has no response This helps creating trigger volume when user wants collision feedback events but not position/velocity to respond to the collision.

    Returns boolean

  • set collisionResponse(response: boolean): void

    Parameters

    • response: boolean

    Returns void

  • get doNotSerialize(): boolean

    Gets or sets a boolean used to define if the node must be serialized

    Returns boolean

  • set doNotSerialize(value: boolean): void

    Parameters

    • value: boolean

    Returns void

  • get hasVertexAlpha(): boolean

    Gets or sets a boolean indicating that this mesh needs to use vertex alpha data to render. This property is misnamed and should be useVertexAlpha. Note that the mesh will be rendered with alpha blending when this flag is set even if vertex alpha data is missing from the geometry.

    Returns boolean

  • set hasVertexAlpha(value: boolean): void

    Parameters

    • value: boolean

    Returns void

  • get inheritVisibility(): boolean

    If set to true, this node, when renderable, will only be visible if its parent(s) are also visible.

    Returns boolean

    false
    
  • set inheritVisibility(value: boolean): void

    Parameters

    • value: boolean

    Returns void

  • get isVisible(): boolean

    Gets or sets a boolean indicating whether this node is visible, either this node itself when it is renderable or its renderable child nodes when inheritVisibility is true.

    Returns boolean

    true
    
  • set isVisible(value: boolean): void

    Parameters

    • value: boolean

    Returns void

  • get meshBlendingTag(): number

    The packed mesh-blending tag of the source mesh.

    Returns number

  • set meshBlendingTag(value: number): void

    Gets or sets the packed mesh-blending tag for this mesh.

    Group ID occupies bits 0..5 and radius class occupies bits 6..7. Use PackMeshBlendingTag to construct the value. Group 0 disables blending; valid participating groups are 1..63. Meshes in the same nonzero group are treated as one logical surface and do not blend together. This visual-only property does not alter geometry, collision queries, depth, normals, or shadows.

    Parameters

    • value: number

    Returns void

  • set onCollisionPositionChange(callback: () => void): void

    Set a function to call when the collision's position changes

    Parameters

    • callback: () => void

    Returns void

  • set onDispose(callback: () => void): void

    Sets a callback that will be raised when the node will be disposed

    Parameters

    • callback: () => void

    Returns void

  • get onEffectiveEnabledStateChangedObservable(): Observable<boolean>

    An event triggered when the effective enabled state of the node changes, i.e. whenever the value returned by isEnabled changes. Unlike onEnabledStateChangedObservable, this fires for changes caused by an ancestor's enabled state as well as this node's own state. The observable is created on first access, so no cost is incurred for nodes that never observe it.

    Returns Observable<boolean>

  • get pointerOverDisableMeshTesting(): boolean

    Gets or sets the property which disables the test that is checking that the mesh under the pointer is the same than the previous time we tested for it (default: false). Set this property to true if you want thin instances picking to be reported accurately when moving over the mesh. Note that setting this property to true will incur some performance penalties when dealing with pointer events for this mesh so use it sparingly.

    Returns boolean

  • set pointerOverDisableMeshTesting(disable: boolean): void

    Parameters

    • disable: boolean

    Returns void

  • get worldMatrixFromCache(): Matrix

    Returns directly the latest state of the mesh World matrix. A Matrix is returned.

    Returns Matrix

  • Adds the passed mesh as a child to the current mesh. The node will remain exactly where it is and its position / rotation will be updated accordingly. This method is equivalent to calling setParent().

    Parameters

    • mesh: TransformNode

      defines the child mesh

    • preserveScalingSign: boolean = false

      if true, keep scaling sign of child. Otherwise, scaling sign might change.

    Returns this

    the current mesh

  • Adds a rotation step to the mesh current rotation. x, y, z are Euler angles expressed in radians. This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set. This means this rotation is made in the mesh local space only. It's useful to set a custom rotation order different from the BJS standard one YXZ. Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.

    mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);
    

    Note that addRotation() accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values. Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles.

    Parameters

    • x: number

      Rotation to add

    • y: number

      Rotation to add

    • z: number

      Rotation to add

    Returns TransformNode

    the TransformNode.

  • Will start the animation sequence

    Parameters

    • name: string

      defines the range frames for animation sequence

    • Optionalloop: boolean

      defines if the animation should loop (false by default)

    • OptionalspeedRatio: number

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

    • OptionalonAnimationEnd: () => void

      defines a function to be executed when the animation ended (undefined by default)

    Returns Nullable<Animatable>

    the object created for this animation. If range does not exist, it will return null

  • Calculate relative position change from the point of view of behind the front of the mesh. This is performed taking into account the meshes current rotation, so you do not have to care. Supports definition of mesh facing forward or backward definedFacingForwardSearch | See definedFacingForwardSearch.

    Parameters

    • amountRight: number

      defines the distance on the right axis

    • amountUp: number

      defines the distance on the up axis

    • amountForward: number

      defines the distance on the forward axis

    Returns Vector3

    the new displacement vector

  • Calculate relative rotation change from the point of view of behind the front of the mesh. Supports definition of mesh facing forward or backward definedFacingForwardSearch | See definedFacingForwardSearch.

    Parameters

    • flipBack: number

      defines the flip

    • twirlClockwise: number

      defines the twirl

    • tiltRight: number

      defines the tilt

    Returns Vector3

    the new rotation vector

  • Creates a new InstancedMesh from the current mesh.

    Returns the clone.

    Parameters

    • name: string

      the cloned mesh name

    • newParent: Nullable<Node> = null

      the optional Node to parent the clone to.

    • OptionaldoNotCloneChildren: boolean

      if true the model children aren't cloned.

    • OptionalnewSourceMesh: Mesh

      if set this mesh will be used as the source mesh instead of ths instance's one

    Returns InstancedMesh

    the clone

  • Creates an animation range for this node

    Parameters

    • name: string

      defines the name of the range

    • from: number

      defines the starting key

    • to: number

      defines the end key

    Returns void

  • Delete a specific animation range

    Parameters

    • name: string

      defines the name of the range to delete

    • deleteFrames: boolean = true

      defines if animation frames from the range must be deleted as well

    Returns void

  • Disposes the InstancedMesh. Returns nothing.

    Parameters

    • OptionaldoNotRecurse: boolean

      Set to true to not recurse into each children (recurse into each children by default)

    • disposeMaterialAndTextures: boolean = false

      Set to true to also dispose referenced materials and textures (false by default)

    Returns void

  • Prevents the World matrix to be computed any longer. Please note that the "moral" contract is that the world matrix is not going to be updated anymore. It is up to the developer to force updates. You trade flexibility for performance. If you want to update it, you have to unfreeze it first.

    Parameters

    • newWorldMatrix: Nullable<Matrix> = null

      defines an optional matrix to use as world matrix

    • decompose: boolean = false

      defines whether to decompose the given newWorldMatrix or directly assign

    Returns TransformNode

    the TransformNode.

  • Returns the mesh BoundingInfo object or creates a new one and returns if it was undefined. Note that it returns a shallow bounding of the mesh (i.e. it does not include children). However, if the mesh contains thin instances, it will be expanded to include them. If you want the "raw" bounding data instead, then use getRawBoundingInfo(). To get the full bounding of all children, call getHierarchyBoundingVectors instead.

    Returns BoundingInfo

    a BoundingInfo

  • Get all child-meshes of this node

    Type Parameters

    Parameters

    • OptionaldirectDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)

    • Optionalpredicate: (node: Node) => node is T

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

    Returns T[]

    an array of AbstractMesh

  • Get all child-meshes of this node

    Parameters

    • OptionaldirectDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)

    • Optionalpredicate: (node: Node) => boolean

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

    Returns AbstractMesh[]

    an array of AbstractMesh

  • Get all direct children of this node

    Type Parameters

    Parameters

    • Optionalpredicate: (node: Node) => node is T

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

    • OptionaldirectDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)

    Returns T[]

    an array of Node

  • Get all direct children of this node

    Parameters

    • Optionalpredicate: (node: Node) => boolean

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

    • OptionaldirectDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)

    Returns Node[]

    an array of Node

  • Get all child-transformNodes of this node

    Parameters

    • OptionaldirectDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered

    • Optionalpredicate: (node: Node) => boolean

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

    Returns TransformNode[]

    an array of TransformNode

  • Returns the closest mesh facet index at (x,y,z) World coordinates, null if not found

    Parameters

    • x: number

      defines x coordinate

    • y: number

      defines y coordinate

    • z: number

      defines z coordinate

    • Optionalprojected: Vector3

      sets as the (x,y,z) world projection on the facet

    • checkFace: boolean = false

      if true (default false), only the facet "facing" to (x,y,z) or only the ones "turning their backs", according to the parameter "facing" are returned

    • facing: boolean = true

      if facing and checkFace are true, only the facet "facing" to (x, y, z) are returned : positive dot (x, y, z) * facet position. If facing si false and checkFace is true, only the facet "turning their backs" to (x, y, z) are returned : negative dot (x, y, z) * facet position

    Returns Nullable<number>

    the face index if found (or null instead)

  • Returns the closest mesh facet index at (x,y,z) local coordinates, null if not found

    Parameters

    • x: number

      defines x coordinate

    • y: number

      defines y coordinate

    • z: number

      defines z coordinate

    • Optionalprojected: Vector3

      sets as the (x,y,z) local projection on the facet

    • checkFace: boolean = false

      if true (default false), only the facet "facing" to (x,y,z) or only the ones "turning their backs", according to the parameter "facing" are returned

    • facing: boolean = true

      if facing and checkFace are true, only the facet "facing" to (x, y, z) are returned : positive dot (x, y, z) * facet position. If facing si false and checkFace is true, only the facet "turning their backs" to (x, y, z) are returned : negative dot (x, y, z) * facet position

    Returns Nullable<number>

    the face index if found (or null instead)

  • Will return all nodes that have this node as ascendant

    Type Parameters

    Parameters

    • OptionaldirectDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered

    • Optionalpredicate: (node: Node) => node is T

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

    Returns T[]

    all children nodes of all types

  • Will return all nodes that have this node as ascendant

    Parameters

    • OptionaldirectDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered

    • Optionalpredicate: (node: Node) => boolean

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

    Returns Node[]

    all children nodes of all types

  • Return the minimum and maximum world vectors of the entire hierarchy under current node

    Parameters

    • includeDescendants: boolean = true

      Include bounding info from descendants as well (true by default)

    • predicate: Nullable<(abstractMesh: AbstractMesh) => boolean> = null

      defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors

    Returns { max: Vector3; min: Vector3 }

    the new bounding vectors

  • Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.

    Parameters

    • kind: string

      kind of verticies to retrieve (eg. positions, normals, uvs, etc.)

    • OptionalcopyWhenShared: boolean

      If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.

    • OptionalforceCopy: boolean

      defines a boolean forcing the copy of the buffer no matter what the value of copyWhenShared is

    Returns Nullable<FloatArray>

    a float array or a Float32Array of the requested kind of data : positions, normals, uvs, etc.

  • Checks if the passed Ray intersects with the mesh. A mesh triangle can be picked both from its front and back sides, irrespective of orientation.

    Parameters

    • ray: Ray

      defines the ray to use. It should be in the mesh's LOCAL coordinate space.

    • OptionalfastCheck: boolean

      defines if fast mode (but less precise) must be used (false by default)

    • OptionaltrianglePredicate: TrianglePickingPredicate

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

    • onlyBoundingInfo: boolean = false

      defines a boolean indicating if picking should only happen using bounding info (false by default)

    • OptionalworldToUse: Matrix

      defines the world matrix to use to get the world coordinate of the intersection point

    • skipBoundingInfo: boolean = false

      a boolean indicating if we should skip the bounding info check

    Returns PickingInfo

    the picking info

  • True if the mesh intersects another mesh or a SolidParticle object

    Parameters

    • mesh: AbstractMesh | SolidParticle

      defines a target mesh or SolidParticle to test

    • precise: boolean = false

      Unless the parameter precise is set to true the intersection is computed according to Axis Aligned Bounding Boxes (AABB), else according to OBB (Oriented BBoxes)

    • OptionalincludeDescendants: boolean

      Can be set to true to test if the mesh defined in parameters intersects with the current mesh or any child meshes

    Returns boolean

    true if there is an intersection

  • Is this node a descendant of the given node? The function will iterate up the hierarchy until the ancestor was found or no more parents defined

    Parameters

    • ancestor: Node

      defines the parent node to inspect

    Returns boolean

    a boolean indicating if this node is a descendant of the given node

  • Is this node enabled? If the node has a parent, all ancestors will be checked and false will be returned if any are false (not enabled), otherwise will return true

    Parameters

    • checkAncestors: boolean = true

      indicates if this method should check the ancestors. The default is to check the ancestors. If set to false, the method will return the value of this node without checking ancestors

    Returns boolean

    whether this node (and its parent) is enabled

    To observe changes to the value returned when calling this with checkAncestors set to true (the default, i.e. the effective enabled state), subscribe to onEffectiveEnabledStateChangedObservable. To observe changes to the value returned when calling this with checkAncestors set to false (i.e. this node's own enabled state only), subscribe to onEnabledStateChangedObservable.

  • Boolean : True if the mesh owns the requested kind of data.

    Parameters

    • kind: string

      defines which buffer to check (positions, indices, normals, etc). Possible kind values :

      • VertexBuffer.PositionKind
      • VertexBuffer.UVKind
      • VertexBuffer.UV2Kind
      • VertexBuffer.UV3Kind
      • VertexBuffer.UV4Kind
      • VertexBuffer.UV5Kind
      • VertexBuffer.UV6Kind
      • VertexBuffer.ColorKind
      • VertexBuffer.MatricesIndicesKind
      • VertexBuffer.MatricesIndicesExtraKind
      • VertexBuffer.MatricesWeightsKind
      • VertexBuffer.MatricesWeightsExtraKind

    Returns boolean

    true if data kind is present

  • Orients a mesh towards a target point. Mesh must be drawn facing user.

    Parameters

    • targetPoint: Vector3

      the position (must be in same space as current mesh) to look at

    • yawCor: number = 0

      optional yaw (y-axis) correction in radians

    • pitchCor: number = 0

      optional pitch (x-axis) correction in radians

    • rollCor: number = 0

      optional roll (z-axis) correction in radians

    • space: Space = Space.LOCAL

      the chosen space of the target

    Returns TransformNode

    the TransformNode.

  • Perform relative position change from the point of view of behind the front of the mesh. This is performed taking into account the meshes current rotation, so you do not have to care. Supports definition of mesh facing forward or backward definedFacingForwardSearch | See definedFacingForwardSearch.

    Parameters

    • amountRight: number

      defines the distance on the right axis

    • amountUp: number

      defines the distance on the up axis

    • amountForward: number

      defines the distance on the forward axis

    Returns AbstractMesh

    the current mesh

  • Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units)

    Parameters

    • includeDescendants: boolean = true

      Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false

    • ignoreRotation: boolean = false

      ignore rotation when computing the scale (ie. object will be axis aligned). Default is false

    • Optionalpredicate: Nullable<(node: AbstractMesh) => boolean>

      predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling

    Returns AbstractMesh

    the current mesh

  • Resets the draw wrappers cache for all submeshes of this abstract mesh

    Parameters

    • OptionalpassId: number

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

    • immediate: boolean = false

      If true, the effect will be released immediately, otherwise it will be released at the next frame

    Returns void

  • Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space. space (default LOCAL) can be either Space.LOCAL, either Space.WORLD. Note that the property rotationQuaternion is then automatically updated and the property rotation is set to (0,0,0) and no longer used. The passed axis is also normalized.

    Parameters

    • axis: Vector3

      the axis to rotate around

    • amount: number

      the amount to rotate in radians

    • Optionalspace: Space

      Space to rotate in (Default: local)

    Returns TransformNode

    the TransformNode.

  • Perform relative rotation change from the point of view of behind the front of the mesh. Supports definition of mesh facing forward or backward definedFacingForwardSearch | See definedFacingForwardSearch.

    Parameters

    • flipBack: number

      defines the flip

    • twirlClockwise: number

      defines the twirl

    • tiltRight: number

      defines the tilt

    Returns AbstractMesh

    the current mesh

  • Sets the mesh indices. Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array). If the mesh has no geometry, a new Geometry object is created and set to the mesh. This method creates a new index buffer each call. Returns the Mesh.

    Parameters

    • indices: IndicesArray

      the source data

    • totalVertices: Nullable<number> = null

      defines the total number of vertices referenced by indices (could be null)

    Returns Mesh

    source mesh

  • Sets the material to be used to render the mesh in a specific render pass

    Parameters

    • renderPassId: number

      render pass id

    • Optionalmaterial: Material

      material to use for this render pass. If undefined is passed, no specific material will be used for this render pass but the regular material will be used instead (mesh.material)

    Returns void

  • Defines the passed node as the parent of the current node. The node will remain exactly where it is and its position / rotation will be updated accordingly. If you don't want to preserve the current rotation / position, assign the parent through parent accessor. Note that if the mesh has a pivot matrix / point defined it will be applied after the parent was updated. In that case the node will not remain in the same space as it is, as the pivot will be applied. To avoid this, you can set updatePivot to true and the pivot will be updated to identity

    Parameters

    • node: Nullable<Node>

      the node ot set as the parent

    • preserveScalingSign: boolean = false

      if true, keep scaling sign of child. Otherwise, scaling sign might change.

    • updatePivot: boolean = false

      if true, update the pivot matrix to keep the node in the same space as before

    Returns TransformNode

    this TransformNode.

  • Sets the vertex data of the mesh geometry for the requested kind. If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data. The data are either a numeric array either a Float32Array. The parameter updatable is passed as is to the underlying Geometry object constructor (if initially none) or updater. The parameter stride is an optional positive integer, it is usually automatically deducted from the kind (3 for positions or normals, 2 for UV, etc). Note that a new underlying VertexBuffer object is created each call. If the kind is the PositionKind, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.

    Possible kind values :

    • VertexBuffer.PositionKind
    • VertexBuffer.UVKind
    • VertexBuffer.UV2Kind
    • VertexBuffer.UV3Kind
    • VertexBuffer.UV4Kind
    • VertexBuffer.UV5Kind
    • VertexBuffer.UV6Kind
    • VertexBuffer.ColorKind
    • VertexBuffer.MatricesIndicesKind
    • VertexBuffer.MatricesIndicesExtraKind
    • VertexBuffer.MatricesWeightsKind
    • VertexBuffer.MatricesWeightsExtraKind

    Returns the Mesh.

    Parameters

    • kind: string

      defines vertex data kind

    • data: FloatArray

      defines the data source

    • Optionalupdatable: boolean

      defines if the data must be flagged as updatable (false as default)

    • Optionalstride: number

      defines the vertex stride (optional)

    Returns AbstractMesh

    the current mesh

  • Updates the existing vertex data of the mesh geometry for the requested kind. If the mesh has no geometry, it is simply returned as it is. The data are either a numeric array either a Float32Array. No new underlying VertexBuffer object is created. If the kind is the PositionKind and if updateExtends is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed. If the parameter makeItUnique is true, a new global geometry is created from this positions and is set to the mesh.

    Possible kind values :

    • VertexBuffer.PositionKind
    • VertexBuffer.UVKind
    • VertexBuffer.UV2Kind
    • VertexBuffer.UV3Kind
    • VertexBuffer.UV4Kind
    • VertexBuffer.UV5Kind
    • VertexBuffer.UV6Kind
    • VertexBuffer.ColorKind
    • VertexBuffer.MatricesIndicesKind
    • VertexBuffer.MatricesIndicesExtraKind
    • VertexBuffer.MatricesWeightsKind
    • VertexBuffer.MatricesWeightsExtraKind

    Returns the Mesh.

    Parameters

    • kind: string

      defines vertex data kind

    • data: FloatArray

      defines the data source

    • OptionalupdateExtends: boolean

      defines if extends info of the mesh must be updated (can be null). This is mostly useful for "position" kind

    • OptionalmakeItUnique: boolean

      defines it the updated vertex buffer must be flagged as unique (false by default)

    Returns Mesh

    the source mesh

  • Returns a node constructor based on type name

    Parameters

    • type: string

      defines the type name

    • name: string

      defines the new node name

    • scene: Scene

      defines the hosting scene

    • Optionaloptions: any

      defines optional options to transmit to constructors

    Returns Nullable<() => Node>

    the new constructor or null

  • Parse animation range data from a serialization object and store them into a given node

    Parameters

    • node: Node

      defines where to store the animation ranges

    • parsedNode: any

      defines the serialization object to read data from

    • _scene: Scene

      defines the hosting scene

    Returns void