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
Defined in
Properties
id
readonly
id:number
The unique identifier for this instance (relative to the InstancedMesh2
it references).
Defined in
isInstanceEntity
readonly
isInstanceEntity:true
=true
Indicates if this is an InstancedEntity
.
Defined in
owner
readonly
owner:InstancedMesh2
<object
,BufferGeometry
,any
,Object3DEventMap
>
InstancedMesh2
to which this instance refers.
Defined in
position
position:
any
The local position.
Defined in
quaternion
quaternion:
Quaternion
The local rotation as Quaternion
.
Defined in
rotation
rotation:
Euler
The local rotation as Euler
.
This works only if allowsEuler
is set to true
in the InstancedMesh2
constructor parameters.
Defined in
scale
scale:
any
The local scale.
Defined in
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
matrix
Get Signature
get matrix():
Matrix4
The local transform matrix got from owner.matricesTexture
.
Returns
Matrix4
Defined in
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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