CraftStudio Wiki
Advertisement

Transform:SetPosition, Transform:SetLocalPosition[]

Transform:SetPosition( [Vector3] position )
Transform:SetLocalPosition( [Vector3] position )

Sets the transform's (global or local) position.

Transform:SetOrientation, Transform:SetLocalOrientation[]

Transform:SetOrientation( [Quaternion] orientation )
Transform:SetLocalOrientation( [Quaternion] orientation )

Sets the transform's (global or local) orientation.

Transform:SetEulerAngles, Transform:SetLocalEulerAngles[]

Transform:SetEulerAngles( [Vector3] angles )
Transform:SetLocalEulerAngles( [Vector3] angles )

Sets the transform's (global or local) orientation based on the specified euler angles in degrees.

Y is yaw, X is pitch, Z is roll, and they are applied in this order.

Transform:SetLocalScale[]

Transform:SetLocalScale( [Vector3] scale )

Sets the transform's local scale.

Transform:GetPosition, Transform:GetLocalPosition[]

[Vector3] Transform:GetPosition()
[Vector3] Transform:GetLocalPosition()

Returns the transform's (global or local) position as a Vector3. GetLocalPosition returns the position relative to the game object's parent. If your game object is at the root of the scene then GetLocalPosition is equivalent to GetPosition.

Transform:GetOrientation, Transform:GetLocalOrientation[]

[Quaternion] Transform:GetOrientation()
[Quaternion] Transform:GetLocalOrientation()

Returns the transform's (global or local) orientation as a Quaternion. GetLocalOrientation returns the orientation relative to the game object's parent. If your game object is at the root of the scene then GetLocalOrientation is equivalent to GetOrientation.

Transform:GetEulerAngles, Transform:GetLocalEulerAngles[]

[Vector3] Transform:GetEulerAngles()
[Vector3] Transform:GetLocalEulerAngles()

Returns the transform's (global or local) orientation as Euler angles in degrees. The angles are packed in a Vector3.

Transform:GetLocalScale[]

[Vector3] Transform:GetLocalScale()

Returns the transform's local scale as a Vector3.

Transform:Move, Transform:MoveLocal[]

Transform:Move( [Vector3] offset )
Transform:MoveLocal( [Vector3] offset )

Offsets the transform's (global or local) position by the specified value on each axis.

Transform:MoveOriented[]

Transform:MoveOriented( [Vector3] offset )

Moves the transform's position along the transform's oriented axes by the specified value on each axis.

Transform:Rotate, Transform:RotateLocal[]

Transform:Rotate( [Quaternion] rotation )
Transform:RotateLocal( [Quaternion] rotation )

Rotates the transform's (global or local) orientation by the specified quaternion.

Transform:RotateEulerAngles, Transform:RotateLocalEulerAngles[]

Transform:RotateEulerAngles( [Vector3] angles )
Transform:RotateLocalEulerAngles( [Vector3] angles )

Rotates the transform's (global or local) orientation by the specified euler angles (in degrees).

Y is yaw, X is pitch, Z is roll, and they are applied in this order.

Transform:LookAt[]

Transform:LookAt( [Vector3] target )

Orients the game object so that it looks at the specified target position.

Example: Looking at another game object[]

local other = CraftStudio.FindGameObject( "some object" )
self.gameObject.transform:LookAt( other.transform:GetPosition() )
Advertisement