Transform component

Transform

2023.12.27

yisky

Hierarchy (view full)

Constructors

Properties

_awoken: boolean = false
_enabled: boolean = false
entity: Entity
object3D: Object3D<Object3DEventMap>

Three.js native Object3D

Transform

userData: {
    [key: string]: any;
}

Component user data

Component

Accessors

  • get children(): readonly Transform[]
  • Get all children

    Returns readonly Transform[]

    Transform

  • get enabled(): boolean
  • Indicates whether the component is enabled.

    Returns boolean

    Component

  • set enabled(value): void
  • Set whether the component is enabled.

    Parameters

    • value: boolean

    Returns void

    Component

  • get isCamera(): boolean
  • Is a camera

    Returns boolean

    Transform

  • get isRoot(): boolean
  • Is root

    Returns boolean

    Transform

  • set matrix(value): void
  • Set local matrix

    Parameters

    • value: Matrix4

    Returns void

    Transform

  • get parent(): Transform
  • Get parent

    Returns Transform

    Transform

  • set parent(parent): void
  • Set parent

    Parameters

    Returns void

    Transform

  • get position(): Vector3
  • Get local position

    Returns Vector3

    Transform

  • set position(position): void
  • Set local position

    Parameters

    • position: Vector3

    Returns void

    Transform

  • get quaternion(): Quaternion
  • Get local quaternion

    Returns Quaternion

    Transform

  • set quaternion(quaternion): void
  • Set local quaternion

    Parameters

    • quaternion: Quaternion

    Returns void

    Transform

  • get rotation(): Euler
  • Get local rotation

    Returns Euler

    Transform

  • set rotation(rotation): void
  • Set local rotation

    Parameters

    • rotation: Euler

    Returns void

    Transform

  • get scale(): Vector3
  • Get local scale

    Returns Vector3

    Transform

  • set scale(scale): void
  • Set local scale

    Parameters

    • scale: Vector3

    Returns void

    Transform

  • get scene(): Scene
  • Scene own the component

    Returns Scene

    Component

Methods

  • Protected

    Awake component callback

    Returns void

    Component

  • Protected

    Destroy component callback

    Returns void

    Component

  • Protected

    Disable component callback

    Returns void

    Component

  • Protected

    Enable component callback

    Returns void

    Component

  • Add a child to the transform

    Parameters

    Returns Transform

    Transform

  • Destroy component

    Returns void

    Component

  • Clear subscribers

    Returns void

    EventDispatcher

  • Emit event

    Parameters

    • event: {
          type: string;
          [key: string]: any;
      }
      • [key: string]: any
      • type: string

    Returns void

    EventDispatcher

  • Returns a vector representing the direction of transform's positive z-axis in world space.

    Parameters

    • target: Vector3

      The result will be copied into this Vector3.

    Returns Vector3

    Transform

  • Returns a vector representing the position of the transforms in world space.

    Parameters

    • target: Vector3

      The result will be copied into this Vector3

    Returns Vector3

    Transform

  • Returns a quaternion representing the rotation of the transform in world space.

    Parameters

    • target: Quaternion

      The result will be copied into this Quaternion.

    Returns Quaternion

    Transform

  • Returns a vector of the scaling factors applied to the transform for each axis in world space.

    Parameters

    • target: Vector3

      The result will be copied into this Vector3

    Returns Vector3

    Transform

  • Converts the vector from this object's local space to world space.

    Parameters

    • vector: Vector3

      A vector representing a position in this object's local space.

    Returns Vector3

    Transform

  • Rotates the object to face a point in world space.

    Parameters

    • target: Vector3

      A vector representing a position in world space to look at.

    Returns void

    Transform

  • Unsubscribe a event, if the callback param is not defined, all subscribers of this type will be removed.

    Parameters

    Returns void

    EventDispatcher

  • Subscribe a event

    Parameters

    • type: string

      event type

    • callback: SubscriberCallbackFn

      callback functions

    • Optionaloptions: {
          priority?: Priority;
          target?: any;
      } = {}

      options

      • Optionalpriority?: Priority
      • Optionaltarget?: any

    Returns void

    EventDispatcher

  • Subscribe a event, just emit once

    Parameters

    Returns void

    EventDispatcher

  • Remove all children on the transform

    Returns Transform

    Transform

  • Remove a child from the transform

    Parameters

    Returns Transform

    Transform

  • Remove the transfrom from parent

    Returns Transform

    Transform

  • Rotate an transform along an axis in object space.

    Parameters

    • axis: Vector3

      A normalized vector in object space.

    • angle: number

      The angle in radians.

    Returns void

    Transform

  • Rotate an object along an axis in world space.

    Parameters

    • axis: Vector3

      A normalized vector in world space.

    • angle: number

      The angle in radians.

    Returns void

    Transform

  • Rotates the transform around x axis in local space.

    Parameters

    • angle: number

      The angle to rotate in radians.

    Returns void

    Transform

  • Rotates the transform around y axis in local space.

    Parameters

    • angle: number

      The angle to rotate in radians.

    Returns void

    Transform

  • Rotates the transform around z axis in local space.

    Parameters

    • angle: number

      The angle to rotate in radians.

    Returns void

    Transform

  • Set transformation

    Parameters

    Returns void

    Transform

  • Translate an transform by distance along an axis in object space

    Parameters

    • axis: Vector3

      A normalized vector in object space.

    • distance: number

      The distance to translate.

    Returns void

    Transform

  • Translates transform along x axis in object space by distance units.

    Parameters

    • distance: number

      The distance to translate.

    Returns void

    Transform

  • Translates transform along y axis in object space by distance units.

    Parameters

    • distance: number

      The distance to translate.

    Returns void

    Transform

  • Translates transform along z axis in object space by distance units.

    Parameters

    • distance: number

      The distance to translate.

    Returns void

    Transform

  • Update transform world matrix

    Returns void

    Transform

  • Converts the vector from world space to this object's local space.

    Parameters

    • vector: Vector3

      A vector representing a position in world space.

    Returns Vector3

    Transform