Skip to content

InstancedEntity

Represents an instance in an InstancedMesh2. This class stores transformation data (position, rotation, scale) and provides methods to manipulate them.

Constructors

new InstancedEntity()

new InstancedEntity(owner, id, useEuler): InstancedEntity

This object is instantiated automatically by setting createInstances to true in the InstancedMesh2 constructor parameters. Dont instantiate this manually.

Parameters

owner: InstancedMesh2<object, BufferGeometry, any, Object3DEventMap>

The InstancedMesh2 that owns this instance.

id: number

The unique identifier for this instance within the InstancedMesh2.

useEuler: boolean

Whether to use Euler rotations in addition to quaternion rotations.

Returns

InstancedEntity

Defined in

core/InstancedEntity.ts:84

Properties

id

readonly id: number

The unique identifier for this instance (relative to the InstancedMesh2 it references).

Defined in

core/InstancedEntity.ts:20


isInstanceEntity

readonly isInstanceEntity: true = true

Indicates if this is an InstancedEntity.

Defined in

core/InstancedEntity.ts:16


owner

readonly owner: InstancedMesh2<object, BufferGeometry, any, Object3DEventMap>

InstancedMesh2 to which this instance refers.

Defined in

core/InstancedEntity.ts:24


position

position: any

The local position.

Defined in

core/InstancedEntity.ts:28


quaternion

quaternion: Quaternion

The local rotation as Quaternion.

Defined in

core/InstancedEntity.ts:36


rotation

rotation: Euler

The local rotation as Euler. This works only if allowsEuler is set to true in the InstancedMesh2 constructor parameters.

Defined in

core/InstancedEntity.ts:41


scale

scale: any

The local scale.

Defined in

core/InstancedEntity.ts:32

Accessors

color

Get Signature

get color(): Color

Color set and got from owner.colorsTexture.

Returns

Color

Set Signature

set color(value): void

Parameters

value: ColorRepresentation

Returns

void

Defined in

core/InstancedEntity.ts:52


matrix

Get Signature

get matrix(): Matrix4

The local transform matrix got from owner.matricesTexture.

Returns

Matrix4

Defined in

core/InstancedEntity.ts:70


matrixWorld

Get Signature

get matrixWorld(): Matrix4

The world transform matrix got by multiplying the matrix got from owner.matricesTexture and this.owner.matrixWorld.

Returns

Matrix4

Defined in

core/InstancedEntity.ts:75


morph

Get Signature

get morph(): Mesh

Morph target influences set and got from owner.morphTexture.

Returns

Mesh

Set Signature

set morph(value): void

Parameters

value: Mesh

Returns

void

Defined in

core/InstancedEntity.ts:64


opacity

Get Signature

get opacity(): number

Opacity set and got from owner.colorsTexture.

Returns

number

Set Signature

set opacity(value): void

Parameters

value: number

Returns

void

Defined in

core/InstancedEntity.ts:58


visible

Get Signature

get visible(): boolean

The visibility state set and got from owner.visibilityArray.

Returns

boolean

Set Signature

set visible(value): void

Parameters

value: boolean

Returns

void

Defined in

core/InstancedEntity.ts:46

Methods

applyMatrix4()

applyMatrix4(m): this

Applies the matrix transform to the object and updates the object’s position, rotation and scale.

Parameters

m: Matrix4

The matrix to apply.

Returns

this

The instance of the object.

Defined in

core/InstancedEntity.ts:197


applyQuaternion()

applyQuaternion(q): this

Applies the rotation represented by the quaternion to the object.

Parameters

q: Quaternion

The quaternion representing the rotation to apply.

Returns

this

The instance of the object.

Defined in

core/InstancedEntity.ts:207


copyTo()

copyTo(target): void

Copies the transformation properties (position, scale, quaternion) of this instance to the specified Object3D.

Parameters

target: Object3D

The Object3D where the transformation properties will be copied.

Returns

void

Defined in

core/InstancedEntity.ts:185


getUniform()

getUniform(name, target?): any

Retrieves the uniform value associated with the given name.

Parameters

name: string

The name of the uniform to retrieve.

target?: any

Optional target object where the uniform value will be written.

Returns

any

The retrieved uniform value.

Defined in

core/InstancedEntity.ts:168


rotateOnAxis()

rotateOnAxis(axis, angle): this

Rotate an object along an axis in object space. The axis is assumed to be normalized.

Parameters

axis: Vector3

A normalized vector in object space.

angle: number

The angle in radians.

Returns

this

The instance of the object.

Defined in

core/InstancedEntity.ts:218


rotateOnWorldAxis()

rotateOnWorldAxis(axis, angle): this

Rotate an object along an axis in world space. The axis is assumed to be normalized. Method Assumes no rotated parent.

Parameters

axis: Vector3

A normalized vector in world space.

angle: number

The angle in radians.

Returns

this

The instance of the object.

Defined in

core/InstancedEntity.ts:230


rotateX()

rotateX(angle): this

Rotates the object around x axis in local space.

Parameters

angle: number

The angle to rotate in radians.

Returns

this

The instance of the object.

Defined in

core/InstancedEntity.ts:241


rotateY()

rotateY(angle): this

Rotates the object around y axis in local space.

Parameters

angle: number

The angle to rotate in radians.

Returns

this

The instance of the object.

Defined in

core/InstancedEntity.ts:250


rotateZ()

rotateZ(angle): this

Rotates the object around z axis in local space.

Parameters

angle: number

The angle to rotate in radians.

Returns

this

The instance of the object.

Defined in

core/InstancedEntity.ts:259


setUniform()

setUniform(name, value): void

Sets the uniform value for the given name

Parameters

name: string

The name of the uniform to set.

value: any

The new value for the uniform.

Returns

void

Defined in

core/InstancedEntity.ts:177


translateOnAxis()

translateOnAxis(axis, distance): this

Translate an object by distance along an axis in object space. The axis is assumed to be normalized.

Parameters

axis: Vector3

A normalized vector in object space.

distance: number

The distance to translate.

Returns

this

The instance of the object.

Defined in

core/InstancedEntity.ts:269


translateX()

translateX(distance): this

Translates object along x axis in object space by distance units.

Parameters

distance: number

The distance to translate.

Returns

this

The instance of the object.

Defined in

core/InstancedEntity.ts:280


translateY()

translateY(distance): this

Translates object along y axis in object space by distance units.

Parameters

distance: number

The distance to translate.

Returns

this

The instance of the object.

Defined in

core/InstancedEntity.ts:289


translateZ()

translateZ(distance): this

Translates object along z axis in object space by distance units.

Parameters

distance: number

The distance to translate.

Returns

this

The instance of the object.

Defined in

core/InstancedEntity.ts:298


updateMatrix()

updateMatrix(): void

Updates the transformation matrix with its current position, quaternion, and scale. The updated matrix is stored in the owner.matricesTexture.

Returns

void

Defined in

core/InstancedEntity.ts:101


updateMatrixPosition()

updateMatrixPosition(): void

Updates only the position component of the transformation matrix. This is useful if only position changes, avoiding recalculating the full matrix. The updated matrix is stored in the owner.matricesTexture.

Returns

void

Defined in

core/InstancedEntity.ts:147