Skip to main content

TTransform

A transform describes an option in 3D space

Index

Constructors

constructor

  • new TTransform(translation?: undefined | vec3, rotation?: undefined | quat, scale?: undefined | vec3): default
  • Parameters

    • translation: undefined | vec3 = undefined
    • rotation: undefined | quat = undefined
    • scale: undefined | vec3 = undefined

    Returns default

Properties

publicrotation

rotation: quat

publicscale

scale: vec3

publictranslation

translation: vec3

Methods

publicadd

  • Adds one transform to another


    Parameters

    Returns default

    combined transform

publicgetMatrix

  • getMatrix(): mat4
  • Gets matrix and applies scale


    Returns mat4

publiclookAt

  • lookAt(target: vec3): void
  • Adjusts the rotation so it is looking towards a given position.

    This method calculates the direction from the current position to the target position, then calculates the right and up vectors based on this direction. Finally, it creates a rotation quaternion from these vectors and sets the rotation to this quaternion.


    Parameters

    • target: vec3

      The target position as a vec3

    Returns void

publicrotateX

  • rotateX(angle: number): void
  • Rotate about the X axis


    Parameters

    • angle: number

      (in radians)

    Returns void

publicrotateY

  • rotateY(angle: number): void
  • Rotate about the Y axis


    Parameters

    • angle: number

      (in radians)

    Returns void

publicrotateZ

  • rotateZ(angle: number): void
  • Rotate about the Z axis


    Parameters

    • angle: number

      (in radians)

    Returns void