Transform:SetPosition( --[[ position (Vector3) ]] )
Transform:SetLocalPosition( --[[ position (Vector3) ]] )
Sets the transform’s (global or local) position.
self.gameObject.transform:SetPosition( Vector3:New( 5, 0, 0 ) )
Transform:SetOrientation( --[[ orientation (Quaternion) ]] )
Transform:SetLocalOrientation( --[[ orientation (Quaternion) ]] )
Sets the transform’s (global or local) orientation.
Transform:SetEulerAngles( --[[ angles (Vector3) ]] )
Transform:SetLocalEulerAngles( --[[ angles (Vector3) ]] )
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( --[[ scale (Vector3) ]] )
Sets the transform’s local scale.
-- Returns a Vector3
Transform:GetPosition()
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
.
-- Returns a Quaternion
Transform:GetOrientation()
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
.
-- Returns a Vector3
Transform:GetEulerAngles()
Transform:GetLocalEulerAngles()
Returns the transform’s (global or local) orientation as Euler angles in degrees. The angles are packed in a Vector3
.
-- Returns a Vector3
Transform:GetLocalScale()
Returns the transform’s local scale as a Vector3
.
Transform:Move( --[[ offset (Vector3) ]] )
Transform:MoveLocal( --[[ offset (Vector3) ]] )
Offsets the transform’s (global or local) position by the specified value on each axis.
Transform:MoveOriented( --[[ offset (Vector3) ]] )
Moves the transform’s position along the transform’s oriented axes by the specified value on each axis.
Transform:Rotate( --[[ rotation (Quaternion) ]] )
Transform:RotateLocal( --[[ rotation (Quaternion) ]] )
Rotates the transform’s (global or local) orientation by the specified quaternion.
Transform:RotateEulerAngles( --[[ angles (Vector3) ]] )
Transform:RotateLocalEulerAngles( --[[ angles (Vector3) ]] )
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( --[[ target (Vector3) ]] )
Orients the game object so that it looks at the specified target position.
local other = CS.FindGameObject( "some object" )
self.gameObject.transform:LookAt( other.transform:GetPosition() )