CLASSES
TagsA - Z

AbstractMesh

NodeMesh

Description

class AbstractMesh extends Node

This class represents a mesh which can't be instantiated

Constructor

new AbstractMesh(name, scene)

The AbstractMesh constructor

Parameters

Name Type Description
name string The new name
scene Scene The scene where the mesh is.

Members

static BILLBOARDMODE_NONE : number

The billboard Mode None, the object is normal by default

@default AbstractMesh.BILLBOARDMODE_NONE

static BILLBOARDMODE_X : number

The billboard Mode X

@default AbstractMesh.BILLBOARDMODE_X

static BILLBOARDMODE_Y : number

The billboard Mode Y

@default AbstractMesh.BILLBOARDMODE_Y

static BILLBOARDMODE_Z : number

The billboard Mode Z

@default AbstractMesh.BILLBOARDMODE_Z

static BILLBOARDMODE_ALL : number

The billboard Mode

@default AbstractMesh.BILLBOARDMODE_ALL

onCollideObservable : Observable<AbstractMesh>

An event triggered when this mesh collides with another one

@type {BABYLON.Observable}

onCollide : () => void

onCollisionPositionChangeObservable : Observable<Vector3>

An event triggered when the collision's position changes

@type {BABYLON.Observable}

onCollisionPositionChange : () => void

onAfterWorldMatrixUpdateObservable : Observable<AbstractMesh>

An event triggered after the world matrix is updated

@type {BABYLON.Observable}

definedFacingForward : boolean

position : Vector3

The mesh position

@default Vector3(0, 0, 0)

billboardMode : number

The mesh billboardMode

@default AbstractMesh.BILLBOARDMODE_NONE

visibility : number

The mesh visibility

@default 1.0

alphaIndex : number

infiniteDistance : boolean

Is infinite distance

@default false

isVisible : boolean

Is visible

@default true

isPickable : boolean

Is pickable

@default true

showBoundingBox : boolean

Show bounding box

@default false

showSubMeshesBoundingBox : boolean

Show submeshes Bounding box

@default false

isBlocker : boolean

Is blocker

@default false

renderingGroupId : number

The rendering group ID

@default 0

material : Material

The material

receiveShadows : boolean

Receive shadows

@default false

renderOutline : boolean

Render Outline

outlineColor : Color3

outline color

outlineWidth : number

outline Width

renderOverlay : boolean

overlayColor : Color3

overlayAlpha : number

hasVertexAlpha : boolean

useVertexColors : boolean

applyFog : boolean

computeBonesUsingShaders : boolean

scalingDeterminant : number

numBoneInfluencers : number

useOctreeForRenderingSelection : boolean

Is use octree for rendering selection

@default true

useOctreeForPicking : boolean

Is use octree for picking

@default true

useOctreeForCollisions : boolean

Is use octree for collisions

@default true

layerMask : number

The layer mask

@default 0xFFFFFFFF

alwaysSelectAsActiveMesh : boolean

actionManager : ActionManager

This scene's action manager

@type {BABYLON.ActionManager}

physicsImpostor : undefined

onPhysicsCollide : (collidedMesh: AbstractMesh, contact: any) => void

ellipsoid : Vector3

Ellipsoid

ellipsoidOffset : Vector3

Ellipsoid offset

edgesWidth : number

edgesColor : Color4

subMeshes : SubMesh[]

subMeshes

skeleton : Skeleton

The skeleton

rotation : Vector3

Getting the rotation object.

If rotation quaternion is set, this vector will (almost always) be the Zero vector!

scaling : Vector3

The mesh scaling

@default Vector3(1,1,1)

rotationQuaternion : Quaternion

The mesh rotation Quaternion

@default Quaternion(x, y, z, w)

isBlocked : boolean

useBones : boolean

worldMatrixFromCache : Matrix

World Matrix from cache

absolutePosition : Vector3

Absolute Position

isWorldMatrixFrozen : boolean

checkCollisions : boolean

Is check collisions

@default false

Methods

toString(fullDetails) string

Parameters

Name Type Description
optional fullDetails boolean

updatePoseMatrix(matrix) void

Parameters

Name Type Description
matrix Matrix @param matrix

getPoseMatrix() Matrix

disableEdgesRendering() void

enableEdgesRendering(epsilon, checkVerticesInsteadOfIndices) void

Parameters

Name Type Description
optional epsilon number
optional checkVerticesInsteadOfIndices boolean

getLOD(camera) AbstractMesh

Parameters

Name Type Description
camera Camera

getTotalVertices() number

Get the total vertices

getIndices() number[]

To access the mesh vertices data

getVerticesData(kind) number[]

To access the mesh vertices data

Parameters

Name Type Description
kind string @param kind

isVerticesDataPresent(kind) boolean

Is vertices data present

Parameters

Name Type Description
kind string @param kind

getBoundingInfo() BoundingInfo

Get the bounding info

setBoundingInfo(boundingInfo) void

Parameters

Name Type Description
boundingInfo BoundingInfo

getWorldMatrix() Matrix

Get the world matrix

freezeWorldMatrix() void

unfreezeWorldMatrix() void

rotate(axis, amount, space) void

Rotate this mesh with the given axis and the given angle in the mesh's space.

The mesh's "rotationQuaternion" property will be set to the new rotation. The mesh's "rotation" property will be set to zero if "rotationQuaternion" property was not set before.

Parameters

Name Type Description
axis Vector3 the rotation axis
amount number the rotation angle
optional space Space local or global

translate(axis, distance, space) void

Translate the mesh with the given axis, with the given distance

Parameters

Name Type Description
axis Vector3 the rotation axis
distance number the distance from the origin to the next position
optional space Space local or global

getAbsolutePosition() Vector3

Returns the absolute position

setAbsolutePosition(absolutePosition) void

Set the absolute position

Parameters

Name Type Description
absolutePosition Vector3 @param absolutePosition

movePOV(amountRight, amountUp, amountForward) void

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.

Parameters

Name Type Description
amountRight number
amountUp number
amountForward number

calcMovePOV(amountRight, amountUp, amountForward) Vector3

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.

Parameters

Name Type Description
amountRight number
amountUp number
amountForward number

rotatePOV(flipBack, twirlClockwise, tiltRight) void

Perform relative rotation change from the point of view of behind the front of the mesh.

Supports definition of mesh facing forward or backward.

Parameters

Name Type Description
flipBack number
twirlClockwise number
tiltRight number

calcRotatePOV(flipBack, twirlClockwise, tiltRight) Vector3

Calculate relative rotation change from the point of view of behind the front of the mesh.

Supports definition of mesh facing forward or backward.

Parameters

Name Type Description
flipBack number
twirlClockwise number
tiltRight number

setPivotMatrix(matrix) void

Set the pivot matrix

Parameters

Name Type Description
matrix Matrix @param matrix

getPivotMatrix() Matrix

Get the pivot matrix

markAsDirty(property) void

Parameters

Name Type Description
property string @param property

computeWorldMatrix(force) Matrix

Compute the world matrix, recalculate the world matrix @default false

Parameters

Name Type Description
optional force boolean the force direction

registerAfterWorldMatrixUpdate(func) void

If you'd like to be callbacked after the mesh position, rotation or scaling has been updated

Parameters

Name Type Description
func (mesh: AbstractMesh) => void : callback function to add

unregisterAfterWorldMatrixUpdate(func) void

Parameters

Name Type Description
func (mesh: AbstractMesh) => void

setPositionWithLocalVector(vector3) void

Set the position with a local vector

Parameters

Name Type Description
vector3 Vector3 the translation contact information

getPositionExpressedInLocalSpace() Vector3

Get the position in local space

locallyTranslate(vector3) void

Translate mesh in local space

Parameters

Name Type Description
vector3 Vector3 the translation contact information

lookAt(targetPoint, yawCor, pitchCor, rollCor, space) void

Parameters

Name Type Description
targetPoint Vector3 The position (must be in same space as current mesh) to look at
optional yawCor number yaw (y-axis) correction in radians
optional pitchCor number pitch (x-axis) correction in radians
optional rollCor number

attachToBone(bone, affectedMesh) void

Parameters

Name Type Description
bone Bone
affectedMesh AbstractMesh

detachFromBone() void

isInFrustum(frustumPlanes) boolean

Is in frustum

Parameters

Name Type Description
frustumPlanes Plane[] is between near frustum plan and far frustum plan view

isCompletelyInFrustum(frustumPlanes) boolean

Parameters

Name Type Description
frustumPlanes Plane[] is between near frustum plan and far frustum plan view

intersectsMesh(mesh, SolidParticle, precise) boolean

Parameters

Name Type Description
mesh AbstractMesh or SolidParticle The mesh
optional precise boolean If true, the abstractMesh is closer to the mesh,

intersectsPoint(point) boolean

Intersects Point

Parameters

Name Type Description
point Vector3 the intersect point

setPhysicsState(impostor, options) any

@Deprecated. Use new PhysicsImpostor instead.

*/

Parameters

Name Type Description
optional impostor any The physics impostor Sphere/Box/Plane
optional options PhysicsImpostorParameters @param options

getPhysicsImpostor() PhysicsImpostor

Get a physics impostor

getPhysicsMass() number

@Deprecated. Use getPhysicsImpostor().getParam("mass");

getPhysicsFriction() number

@Deprecated. Use getPhysicsImpostor().getParam("friction");

getPhysicsRestitution() number

@Deprecated. Use getPhysicsImpostor().getParam("restitution");

getPositionInCameraSpace(camera) Vector3

Parameters

Name Type Description
optional camera Camera

getDistanceToCamera(camera) number

Parameters

Name Type Description
optional camera Camera

applyImpulse(force, contactPoint) void

Apply a force

Parameters

Name Type Description
force Vector3 the force direction
contactPoint Vector3 the contact point

setPhysicsLinkWith(otherMesh, pivot1, pivot2, options) void

Link the impostor in order to keep meshes linked

Parameters

Name Type Description
otherMesh Mesh the impostor
pivot1 Vector3 link the impostor with this mesh
pivot2 Vector3 link the impostor with this mesh

updatePhysicsBodyPosition() void

@Deprecated

updatePhysicsBody() void

@Deprecated

Calling this function is not needed anymore.

The physics engine takes care of transofmration automatically.

moveWithCollisions(velocity) void

Move a mesh

Parameters

Name Type Description
velocity Vector3 change the velocity

createOrUpdateSubmeshesOctree(maxCapacity, maxDepth) Octree<SubMesh>

This function will create an octree to help select the right submeshes for rendering, picking and collisions

Please note that you must have a decent number of submeshes to get performance improvements when using octree

Parameters

Name Type Description
optional maxCapacity number @param maxCapacity
optional maxDepth number @param maxDepth

intersects(ray, fastCheck) PickingInfo

Intersects if false, infinite ray !

Parameters

Name Type Description
ray Ray The ray
optional fastCheck boolean if true, stop at the first result

clone(name, newParent, doNotCloneChildren) AbstractMesh

Clone this abstract mesh

Parameters

Name Type Description
name string The new name
newParent Node @param newParent
optional doNotCloneChildren boolean Set true if you want to clone children, false otherwise

releaseSubMeshes() void

Release submeshes

dispose(doNotRecurse) void

Parameters

Name Type Description
optional doNotRecurse boolean @param doNotRecurse

getDirection(localAxis) Vector3

Parameters

Name Type Description
localAxis Vector3

getDirectionToRef(localAxis, result) void

Parameters

Name Type Description
localAxis Vector3
result Vector3

setPivotPoint(point, space) void

Parameters

Name Type Description
point Vector3 the intersect point
optional space Space local or global

getPivotPoint() Vector3

getPivotPointToRef(result) void

Parameters

Name Type Description
result Vector3

getAbsolutePivotPoint() Vector3

getAbsolutePivotPointToRef(result) void

Parameters

Name Type Description
result Vector3