InstancedEntity
Defined in: core/InstancedEntity.ts:12
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
Defined in: core/InstancedEntity.ts:90
This object is instantiated automatically by setting createEntities
to true
in the InstancedMesh2
constructor parameters.
Dont instantiate this manually.
Parameters
owner
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
Properties
id
readonly
id:number
Defined in: core/InstancedEntity.ts:20
The unique identifier for this instance (relative to the InstancedMesh2
it references).
isInstanceEntity
readonly
isInstanceEntity:true
=true
Defined in: core/InstancedEntity.ts:16
Indicates if this is an InstancedEntity
.
owner
readonly
owner:InstancedMesh2
Defined in: core/InstancedEntity.ts:24
InstancedMesh2
to which this instance refers.
position
position:
any
Defined in: core/InstancedEntity.ts:28
The local position.
quaternion
quaternion:
Quaternion
Defined in: core/InstancedEntity.ts:36
The local rotation as Quaternion
.
rotation
rotation:
Euler
Defined in: core/InstancedEntity.ts:41
The local rotation as Euler
.
This works only if allowsEuler
is set to true
in the InstancedMesh2
constructor parameters.
scale
scale:
any
Defined in: core/InstancedEntity.ts:32
The local scale.
Accessors
active
Get Signature
get active():
boolean
Defined in: core/InstancedEntity.ts:52
The availability set and got from owner.availabilityArray
.
Returns
boolean
Set Signature
set active(
value
):void
Defined in: core/InstancedEntity.ts:53
Parameters
value
boolean
Returns
void
color
Get Signature
get color():
Color
Defined in: core/InstancedEntity.ts:58
Color set and got from owner.colorsTexture
.
Returns
Color
Set Signature
set color(
value
):void
Defined in: core/InstancedEntity.ts:59
Parameters
value
ColorRepresentation
Returns
void
matrix
Get Signature
get matrix():
Matrix4
Defined in: core/InstancedEntity.ts:76
The local transform matrix got from owner.matricesTexture
.
Returns
Matrix4
matrixWorld
Get Signature
get matrixWorld():
Matrix4
Defined in: core/InstancedEntity.ts:81
The world transform matrix got by multiplying the matrix got from owner.matricesTexture
and this.owner.matrixWorld
.
Returns
Matrix4
morph
Get Signature
get morph():
Mesh
Defined in: core/InstancedEntity.ts:70
Morph target influences set and got from owner.morphTexture
.
Returns
Mesh
Set Signature
set morph(
value
):void
Defined in: core/InstancedEntity.ts:71
Parameters
value
Mesh
Returns
void
opacity
Get Signature
get opacity():
number
Defined in: core/InstancedEntity.ts:64
Opacity set and got from owner.colorsTexture
.
Returns
number
Set Signature
set opacity(
value
):void
Defined in: core/InstancedEntity.ts:65
Parameters
value
number
Returns
void
visible
Get Signature
get visible():
boolean
Defined in: core/InstancedEntity.ts:46
The visibility state set and got from owner.availabilityArray
.
Returns
boolean
Set Signature
set visible(
value
):void
Defined in: core/InstancedEntity.ts:47
Parameters
value
boolean
Returns
void
Methods
applyMatrix4()
applyMatrix4(
m
):this
Defined in: core/InstancedEntity.ts:212
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.
applyQuaternion()
applyQuaternion(
q
):this
Defined in: core/InstancedEntity.ts:222
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.
copyTo()
copyTo(
target
):void
Defined in: core/InstancedEntity.ts:200
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
getUniform()
getUniform(
name
,target
?):any
Defined in: core/InstancedEntity.ts:174
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.
remove()
remove():
this
Defined in: core/InstancedEntity.ts:321
Removes this entity from its owner instance.
Returns
this
The instance of the object.
rotateOnAxis()
rotateOnAxis(
axis
,angle
):this
Defined in: core/InstancedEntity.ts:233
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.
rotateOnWorldAxis()
rotateOnWorldAxis(
axis
,angle
):this
Defined in: core/InstancedEntity.ts:245
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.
rotateX()
rotateX(
angle
):this
Defined in: core/InstancedEntity.ts:256
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.
rotateY()
rotateY(
angle
):this
Defined in: core/InstancedEntity.ts:265
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.
rotateZ()
rotateZ(
angle
):this
Defined in: core/InstancedEntity.ts:274
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.
setUniform()
setUniform(
name
,value
):void
Defined in: core/InstancedEntity.ts:192
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
translateOnAxis()
translateOnAxis(
axis
,distance
):this
Defined in: core/InstancedEntity.ts:284
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.
translateX()
translateX(
distance
):this
Defined in: core/InstancedEntity.ts:295
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.
translateY()
translateY(
distance
):this
Defined in: core/InstancedEntity.ts:304
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.
translateZ()
translateZ(
distance
):this
Defined in: core/InstancedEntity.ts:313
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.
updateBones()
updateBones(
updateBonesMatrices
,excludeBonesSet
?):void
Defined in: core/InstancedEntity.ts:183
Updates the bones of the skeleton to the instance.
Parameters
updateBonesMatrices
boolean
= true
Whether to update the matrices of the bones. Default is true
.
excludeBonesSet?
Set
<string
>
An optional set of bone names to exclude from updates, skipping their local matrix updates.
Returns
void
updateMatrix()
updateMatrix():
void
Defined in: core/InstancedEntity.ts:107
Updates the transformation matrix with its current position, quaternion, and scale.
The updated matrix is stored in the owner.matricesTexture
.
Returns
void
updateMatrixPosition()
updateMatrixPosition():
void
Defined in: core/InstancedEntity.ts:153
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