Skip to content

Transform

Matías Hermosilla edited this page Jun 3, 2017 · 7 revisions

The 'Transform' Object

Importing

local Transform = require("shadows.Transform")

Functions

Transform transform = Transform:new()
Description: Creates a transform.

local transform = Transform:new()

Methods

Transform:SetParent(Transform transform)
Description: Assigns a transform as a parent of another transform (Makes the coordinates of a transform local to another).

Transform transform = Transform:GetParent()
Description: Gets the parent transform of a transform.

Transform:SetLocalRotation(number Angle)
Description: Sets the local rotation of a transform.

number rotation = Transform:GetLocalRotation()
Description: Gets the local rotation of a transform.

number radians = Transform:GetLocalRadians()
Description: Gets the local rotation of a transform in radians.

Transform:SetRotation(number Angle)
Description: Sets the world rotation of the transform in degrees (use carefully when parented).

number rotation = Transform:GetRotation(number SumRotation)
Description: Gets the rotation of a transform + SumRotation in degrees.

number radians = Transform:GetRadians(number SumRadians)
Description: Gets the rotation of a transform + SumRadians in radians.

Transform:SetLocalPosition(number x, number y[, number z])
Description: Sets the local position of a transform.

number x, number y, number z = Transform:GetLocalPosition()
Description: Gets the local position of a transform.

Transform:SetPosition(number x, number y, number z)
Description: Sets the position of a transform (use carefully when parented).

number x, number y, number z = Transform:GetPosition()
Description: Gets the position of a transform.

table {x=x,y=y,z=z} = Transform:GetPositionVector()
Description: Gets the position of a transform as a vector.

number x, number y, number z = Transform:ToWorld(number x, number y, number z)
Description: Transforms a point to world coordinates.

table Points = Transform:ToWorldPoints(table Points)
Description: Transform multiple points to world coordinates (does not support 'z' coordinate).

number x, number y, number z = Transform:ToLocal(number x, number y, number z)
Description: Transforms a point to local coordinates.

number rotation = Transform:ToWorldAngle(number Angle)
Description: Transform a local angle to world.

number rotation = Transform:ToLocalAngle(number Angle)
Description: Transform a world angle to local.

Clone this wiki locally