Transform
Summary
Represents a position, rotation and scale in one object
Class Properties
identity
A transform that does nothing. No translation, rotation or scaling
Instance Properties
inverse
The inverse of this transform
up
A translation of 1 in the y axis
down
A translation of -1 in the y axis
right
A translation of 1 in the x axis
left
A translation of -1 in the x axis
forward
A translation of 1 in the z axis
back
A translation of -1 in the z axis
position
Get or set the position of this transform
rotation
Get or set the rotation of this transform
scale
number Read/Write
Get or set the scale of this transform
Class Methods
Transform:New(translation, rotation, scale)
Creates a new translation, rotation and scale transform
Returns: Transform
Parameters:
translation
The translation amount
rotation
The rotation amount
scale
number
The scale amount
Example
Transform:New(translation, rotation)
Creates a new translation and rotation transform
Returns: Transform
Parameters:
translation
The translation amount
rotation
The rotation amount
Example
Transform:New(translation)
Creates a new translation transform
Returns: Transform
Parameters:
translation
The translation amount
Example
Transform:New(translation, scale)
Creates a new translation and scale transform
Returns: Transform
Parameters:
translation
The translation amount
scale
number
The scale amount
Example
Transform:Position(x, y, z)
Creates a new translation transform
Returns: Transform
Parameters:
x
number
The x translation amount
y
number
The y translation amount
z
number
The z translation amount
Example
Transform:Position(position)
Creates a new translation transform
Returns: Transform
Parameters:
position
The Vector3 position
Example
Transform:Rotation(x, y, z)
Creates a new rotation transform
Returns: Transform
Parameters:
x
number
The x rotation amount
y
number
The y rotation amount
z
number
The z rotation amount
Example
Transform:Rotation(rotation)
Creates a new rotation transform
Returns: Transform
Parameters:
rotation
The rotation
Example
Transform:Scale(amount)
Creates a new scale transform
Returns: Transform
Parameters:
amount
number
The scale amount
Example
Transform:Lerp(a, b, t)
Interpolates between two transforms
Returns: Transform (A transform that blends between a and b based on the value of t)
Parameters:
a
The first transform
b
The second transform
t
number
The value between 0 and 1 that controls how far between a and b the new transform is
Example
Instance Methods
transform:TransformBy(transform)
Applies another transform to this transform
Returns: Transform
Parameters:
transform
The transform to apply
Example
transform:TranslateBy(translation)
Applies a translation to this transform
Returns: Transform
Parameters:
translation
The translation to apply
Example
transform:TranslateBy(x, y, z)
Applies a translation to this transform
Returns: Transform
Parameters:
x
number
The x translation to apply
y
number
The y translation to apply
z
number
The z translation to apply
Example
transform:RotateBy(rotation)
Applies a rotation to this transform
Returns: Transform
Parameters:
rotation
The rotation to apply
Example
transform:RotateBy(x, y, z)
Applies a rotation to this transform
Returns: Transform
Parameters:
x
number
The x rotation to apply
y
number
The y rotation to apply
z
number
The z rotation to apply
Example
transform:ScaleBy(scale)
Applies a scale to this transform
Returns: Transform
Parameters:
scale
number
The scale value to apply
Example
transform:Multiply(other)
Combines another transform with this one (Does the same as "TransformBy")
Returns: Transform
Parameters:
other
The Transform to apply to this one
Example
Last updated