Module components_transform

Stores a game object's position, rotation, and scale.

Info:

  • Author: Sharper Dev

Functions

Transform:new (gameObject) Creates a transform at the origin with zero rotation and unit scale.
Transform:setPosition (x, y, z) Sets the provided position coordinates; omitted (nil) coordinates remain unchanged.
Transform:setScale (x, y) Sets the provided scale axes; omitted (nil) axes remain unchanged.
Transform:translate (x, y, z) Adds the provided offsets to the current position; omitted offsets default to zero.


Functions

Transform:new (gameObject)
Creates a transform at the origin with zero rotation and unit scale.

Parameters:

  • gameObject table Game object that owns this transform.

Returns:

    table The new Transform.
Transform:setPosition (x, y, z)
Sets the provided position coordinates; omitted (nil) coordinates remain unchanged.

Parameters:

  • x number|nil X coordinate.
  • y number|nil Y coordinate.
  • z number|nil Z coordinate.

Returns:

    table This transform.

Usage:

    thisObject.transform:setPosition(0, 0, 0)
Transform:setScale (x, y)
Sets the provided scale axes; omitted (nil) axes remain unchanged.

Parameters:

  • x number|nil Horizontal scale.
  • y number|nil Vertical scale.

Returns:

    table This transform.

Usage:

    thisObject.transform:setScale(2, 2)
Transform:translate (x, y, z)
Adds the provided offsets to the current position; omitted offsets default to zero.

Parameters:

  • x number|nil Horizontal offset.
  • y number|nil Vertical offset.
  • z number|nil Depth offset.

Returns:

    table This transform.

Usage:

    thisObject.transform:translate(0, 0, 0)
generated by LDoc 1.5.0 Last updated 2026-10-04 12:53:32