Base class for Link, Joint, and Goal representing a frame defined by a position and
rotation in space.
On this page
- Properties
- name
- quaternion
- position
- matrix
- matrixWorld
- parent
- children
- Methods
- setPosition
- setEuler
- setQuaternion
- setWorldPosition
- setWorldEuler
- setWorldQuaternion
- getWorldPosition
- getWorldQuaternion
- traverseParents
- traverse
- find
- addChild
- removeChild
- attachChild
- detachChild
- setMatrixNeedsUpdate
- setMatrixWorldNeedsUpdate
- updateMatrix
- updateMatrixWorld
Properties
name: string
Name of the frame.
quaternion: Float32Array
Orientation of the frame relative to its parent. If modified directly
setMatrixNeedsUpdate must be called.
position: Float32Array
Position of the frame relative to its parent. If modified directly
setMatrixNeedsUpdate must be called.
Local transform matrix composed from the position and quaternion.
World transform matrix computed from the parent world matrix and the local matrix.
The frame this frame is a child of.
The frames this frame is a parent of.
Methods
setPosition( x: number, y: number, z: number ): voidSets the position of the frame relative to its parent.
setEuler( x: number, y: number, z: number ): voidSets the orientation of the frame relative to its parent from Euler angles in radians.
setQuaternion( x: number, y: number, z: number, w: number ): voidSets the orientation of the frame relative to its parent.
setWorldPosition( x: number, y: number, z: number ): voidSets the position of the frame in world space. The local position relative to the parent is computed automatically.
setWorldEuler( x: number, y: number, z: number ): voidSets the orientation of the frame in world space from Euler angles in radians. The local orientation relative to the parent is computed automatically.
setWorldQuaternion( x: number, y: number, z: number, w: number ): voidSets the orientation of the frame in world space. The local orientation relative to the parent is computed automatically.
getWorldPosition( target: Array<number> | Float32Array ): voidWrites the position of the frame in world space into target.
getWorldQuaternion( target: Array<number> | Float32Array ): voidWrites the orientation of the frame in world space into target.
traverseParents( callback: ( frame: Frame ) => boolean ): voidCalls callback for every ancestor starting with the parent. Returning true from the
callback stops the traversal.
traverse( callback: ( frame: Frame ) => boolean ): voidCalls callback for this frame and every descendant in breadth first order. Returning
true from the callback stops traversal below that frame.
find( callback: ( frame: Frame ) => boolean ): Frame | nullReturns the first frame in the tree, including this one, for which callback returns
true, or null if none does.
addChild( child: Frame ): voidAdds a child to this frame and sets its parent to this frame. Throws if the child already has a parent.
removeChild( child: Frame ): voidRemoves the given child from this frame. Throws if the frame is not a child of this frame.
attachChild( child: Frame ): voidAdds the given frame as a child while preserving its world transform.
detachChild( child: Frame ): voidRemoves the given child while preserving its world transform.
setMatrixNeedsUpdate(): voidFlags this frame as needing its local and world matrices updated.
setMatrixWorldNeedsUpdate(): voidFlags this frame and all its descendants as needing their world matrices updated.
updateMatrix(): voidUpdates the local matrix if it has been flagged as needing an update.
updateMatrixWorld(
// Also update the world matrices of all descendants.
updateChildren: boolean = false
): voidUpdates the local and world matrices if they have been flagged as needing an update, updating parent matrices first as needed.