AM_Spatial

AM_Spatial

Gives actors a spatial position with translation, rotation and scale. Spatial actors are arranged in a scene graph hierarchy, with child actors applying their transforms on top of the transforms of their parents. Only use AM_Spatial for actors that are relatively stationary -- it doesn't apply any view-side interpolation to smooth out irregular movement. For moving actors, use AM_Smoothed instead.

Note: AM_Spatial must be paired with PM_Spatial in the pawn.

Extends

Members

# translation :Array.<number>

The local translation of the actor relative to its parent. The value is a 3D vector.

Type:
  • Array.<number>
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>
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>
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>

# 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>

# parent :Actor

The parent of the actor in the hierarchical tree.

Type:
Inherited From:
Example:
const treeActor = TreeActor.create({parent: parentActor});