Extends
Members
# translation :Array.<number>
The local translation of the actor relative to its parent. The value is a 3D vector.
Type:
- Array.<number>
- Inherited From:
- Default Value:
- [0,0,0]
Fires:
- translationChanged
- localChanged
- globalChanged
Example:
spatialActor.set({translation: [1,0,0]}); // Translate this actor one unit in the X direction from its parent.
# rotation :Array.<number>
The local rotation of the actor relative to its parent. The value is a quaternion.
Type:
- Array.<number>
- Inherited From:
- Default Value:
- [0,0,0,1]
Fires:
- rotationChanged
- localChanged
- globalChanged
Example:
spatialActor.set({rotation: q_axisAngle([1,0,0], toRad(90))}); // Rotate this actor 90 degrees around the X axis relative to its parent.
# scale :Array.<number>
The local scale of the actor relative to its parent. The value is a 3D vector.
Warning: Do not set the scale to 0!
Type:
- Array.<number>
- Inherited From:
- Default Value:
- [1,1,1]
Fires:
- scaleChanged
- localChanged
- globalChanged
Example:
spatialActor.set({scale: [2,2,2])}); // Double the size of this actor relative to its parent.
# local :Array.<number>
The local 4x4 transformation matrix. This is the actor's transform relative to its parent.
Warning - Do NOT set this matrix directly. Set the independent translation, rotation, and scale components and let the actor combine them to get the local matrix.
Type:
- Array.<number>
- Inherited From:
# global :Array.<number>
The global 4x4 transformation matrix. This is the actor's transform relative to world space, taking into account its local transform and the local transforms of all of its parents.
Warning - Do NOT set this matrix directly. Set the independent translation, rotation, and scale components and let the actor combine them to get the global matrix.
Type:
- Array.<number>
- Inherited From:
# parent :Actor
The parent of the actor in the hierarchical tree.
Type:
- Inherited From:
Example:
const treeActor = TreeActor.create({parent: parentActor});
Methods
# moveTo(translation)
Tells the actor to move to a new xyz position. The actor moves immediately to the new translation, while its pawn smoothly interpolates over the next few frames. If you want the pawn to pop the new position, set the actor's translation property instead.
Note: All movement is relative to the actor's parent.
Name | Type | Description |
---|---|---|
translation |
Array.<number> | A 3-vector containing the new translation for the actor. |
# rotateTo(rotation)
Tells the actor to rotate to a new orientation. The actor moves immediately to the new rotation, while its pawn smoothly interpolates over the next few frames. If you want the pawn to pop the new position, set the actor's rotation property instead.
Note: All movement is relative to the actor's parent.
Name | Type | Description |
---|---|---|
rotation |
Array.<number> | A quaternion containing the new rotation for the actor. |
# scaleTo(scale)
Tells the actor to scale to a new size. The actor transitions immediately to the new scale, while its pawn smoothly interpolates over the next few frames. If you want the pawn to pop the new scale, set the actor's scale property instead.
Note: All movement is relative to the actor's parent.
Warning: Do not set the scale to 0!
Name | Type | Description |
---|---|---|
scale |
Array.<number> | A 3-vector containing the new scale for the actor. |