Represents a position, rotation and scale in one object
Name | Return Type | Description |
---|---|---|
identity | Transform Read-only | A transform that does nothing. No translation, rotation or scaling |
Name | Return Type | Description |
---|---|---|
inverse | Transform Read-only | The inverse of this transform |
up | Vector3 Read-only | A translation of 1 in the y axis |
down | Vector3 Read-only | A translation of -1 in the y axis |
right | Vector3 Read-only | A translation of 1 in the x axis |
left | Vector3 Read-only | A translation of -1 in the x axis |
forward | Vector3 Read-only | A translation of 1 in the z axis |
back | Vector3 Read-only | A translation of -1 in the z axis |
position | Vector3 Read/Write | Get or set the position of this transform |
rotation | Rotation Read/Write | Get or set the rotation of this transform |
scale | number Read/Write | Get or set the scale of this transform |
Creates a new translation, rotation and scale transform
Returns: Transform
Parameters:
Name | Type | Default | Description |
---|---|---|---|
translation | Vector3 | The translation amount | |
rotation | Rotation | The rotation amount | |
scale | number | The scale amount |
myTransform = Transform:New(Vector3(1, 2, 3), Rotation.identity, 2)
Creates a new translation and rotation transform
Returns: Transform
Parameters:
Name | Type | Default | Description |
---|---|---|---|
translation | Vector3 | The translation amount | |
rotation | Rotation | The rotation amount |
myTransform = Transform:New(Vector3(1, 2, 3), Rotation.identity)
Creates a new translation transform
Returns: Transform
Parameters:
Name | Type | Default | Description |
---|---|---|---|
translation | Vector3 | The translation amount |
myTransform = Transform:New(Vector3(1, 2, 3))
Creates a new translation and scale transform
Returns: Transform
Parameters:
Name | Type | Default | Description |
---|---|---|---|
translation | Vector3 | The translation amount | |
scale | number | The scale amount |
myTransform = Transform:New(Vector3(1, 2, 3), 2)
Creates a new translation transform
Returns: Transform
Parameters:
Name | Type | Default | Description |
---|---|---|---|
x | number | The x translation amount | |
y | number | The y translation amount | |
z | number | The z translation amount |
myTransform = Transform:Position(1, 2, 3)
Creates a new translation transform
Returns: Transform
Parameters:
Name | Type | Default | Description |
---|---|---|---|
position | Vector3 | The Vector3 position |
myTransform = Transform:Position(myVector3)
Creates a new rotation transform
Returns: Transform
Parameters:
Name | Type | Default | Description |
---|---|---|---|
x | number | The x rotation amount | |
y | number | The y rotation amount | |
z | number | The z rotation amount |
myTransform = Transform:Rotation(1, 2, 3)
Creates a new rotation transform
Returns: Transform
Parameters:
Name | Type | Default | Description |
---|---|---|---|
rotation | Rotation | The rotation |
myTransform = Transform:Rotation(myRotation)
Creates a new scale transform
Returns: Transform
Parameters:
Name | Type | Default | Description |
---|---|---|---|
amount | number | The scale amount |
myTransform = Transform:Scale(2)
Interpolates between two transforms
Returns: Transform (A transform that blends between a and b based on the value of t)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
a | Transform | The first transform | |
b | Transform | The second transform | |
t | number | The value between 0 and 1 that controls how far between a and b the new transform is |
newTransform = Transform:Lerp(transformA, transformB, 0.25)
Applies another transform to this transform
Returns: Transform
Parameters:
Name | Type | Default | Description |
---|---|---|---|
transform | Transform | The transform to apply |
newTransform = myTransform:TransformBy(myOtherTransform)
Applies a translation to this transform
Returns: Transform
Parameters:
Name | Type | Default | Description |
---|---|---|---|
translation | Vector3 | The translation to apply |
newTransform = myTransform:TranslateBy(Vector3.up * 3)
Applies a translation to this transform
Returns: Transform
Parameters:
Name | Type | Default | Description |
---|---|---|---|
x | number | The x translation to apply | |
y | number | The y translation to apply | |
z | number | The z translation to apply |
newTransform = myTransform:TranslateBy(1, 2, 3)
Applies a rotation to this transform
Returns: Transform
Parameters:
Name | Type | Default | Description |
---|---|---|---|
rotation | Rotation | The rotation to apply |
newTransform = myTransform:RotateBy(Rotation.left)
Applies a rotation to this transform
Returns: Transform
Parameters:
Name | Type | Default | Description |
---|---|---|---|
x | number | The x rotation to apply | |
y | number | The y rotation to apply | |
z | number | The z rotation to apply |
newTransform = myTransform:RotateBy(45, 0, 0)
Applies a scale to this transform
Returns: Transform
Parameters:
Name | Type | Default | Description |
---|---|---|---|
scale | number | The scale value to apply |
newTransform = myTransform:ScaleBy(2)
Combines another transform with this one (Does the same as "TransformBy")
Returns: Transform
Parameters:
Name | Type | Default | Description |
---|---|---|---|
other | Transform | The Transform to apply to this one |
newTransform = myTransform:Multiply(Transform.up)