> For the complete documentation index, see [llms.txt](https://pahutyakv.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pahutyakv.gitbook.io/docs/mega-extension-pack/transform.md).

# Transform

#### **Properties**

* `ResetProperties()` — Resets world position, rotation and scale to defaults.
* `ResetLocalProperties()` — Resets local position, rotation and scale to defaults.
* `CopyPropertiesFrom(Transform reference)` — Copies world position, rotation and scale from a reference Transform.
* `CopyLocalPropertiesFrom(Transform reference)` — Copies local position, rotation and scale from a reference Transform.
* `RoundProperties(int decimals = 0)` — Rounds world position, rotation (Euler) and scale to the specified decimals.
* `RoundLocalProperties(int decimals = 0)` — Rounds local position, rotation (Euler) and scale to the specified decimals.

***

#### **Global Position**

* `SetPosition(Vector3 position)` — Sets the world position using a Vector3 value.&#x20;
* `SetPosition(Transform reference)` — Sets the world position to match another Transform.&#x20;
* `SetPosition(float x, float y, float z)` — Sets the world position using X, Y, Z coordinates.
* `ResetPosition()` — Resets the world position of the Transform to (0, 0, 0).&#x20;
* `RoundPosition(int decimals = 0)` — Rounds the world position of the Transform to the specified number of decimals.

Axіs:

* `Set/Get PositionX()`
* `Set/Get PositionY()`
* `Set/Get PositionZ()`
* `Set/Get PositionXY()`
* `Set/Get PositionXZ()`
* `Set/Get PositionYZ()`

***

#### **Local Position**

* `SetLocalPosition(Vector3 position)` — Sets the local position using a Vector3 value.&#x20;
* `SetLocalPosition(Transform reference)` — Sets the local position to match another Transform.&#x20;
* `SetLocalPosition(float x, float y, float z)` — Sets the local position using X, Y, Z coordinates.
* `ResetLocalPosition()` — Resets the local position of the Transform to (0, 0, 0).&#x20;
* `RoundLocalPosition(int decimals = 0)` — Rounds the local position of the Transform to the specified number of decimals.

Axis:

* `Set/Get LocalPositionX()`
* `Set/Get LocalPositionY()`
* `Set/Get LocalPositionZ()`
* `Set/Get LocalPositionXY()`
* `Set/Get LocalPositionXZ()`
* `Set/Get LocalPositionYZ()`

***

#### **Global Rotation**

* `SetRotation(Quaternion rotation)` — Sets the world rotation using a Quaternion.&#x20;
* `SetRotation(Vector3 eulerAngles)` — Sets the world rotation using Euler angles in degrees.
* `SetRotation(Transform reference)` — Sets the world rotation to match another Transform.&#x20;
* `SetRotation(float x, float y, float z)` — Sets the world rotation using X, Y, Z Euler angles.
* `ResetRotation()` — Resets the world rotation to Quaternion.identity.
* `RoundRotation(int decimals = 0)` — Rounds the world rotation (Euler angles) to the specified number of decimals.

Axis:

* `Set/Get RotationX()`
* `Set/Get RotationY()`
* `Set/Get RotationZ()`
* `Set/Get RotationXY()`
* `Set/Get RotationXZ()`
* `Set/Get RotationYZ()`

***

**Local Rotation**

* `SetLocalRotation(Quaternion rotation)` — Sets the local rotation using a Quaternion.&#x20;
* `SetLocalRotation(Vector3 eulerAngles)` — Sets the local rotation using Euler angles in degrees.&#x20;
* `SetLocalRotation(Transform reference)` — Sets the local rotation to match another Transform.&#x20;
* `SetLocalRotation(float x, float y, float z)` — Sets the local rotation using X, Y, Z Euler angles.
* `ResetLocalRotation()` — Resets the local rotation to Quaternion.identity (0,0,0).&#x20;
* `RoundLocalRotation(int decimals)` — Rounds the local Euler angles to the specified number of decimals.

Axis:

* `Set/Get LocalRotationX()`
* `Set/Get LocalRotationY()`
* `Set/Get LocalRotationZ()`
* `Set/Get LocalRotationXY()`
* `Set/Get LocalRotationXZ()`
* `Set/Get LocalRotationYZ()`

***

#### **Scale**

* `SetScale(float scale)` — Sets the local scale uniformly on all axes.&#x20;
* `SetScale(Vector3 scale)` — Sets the local scale using a Vector3.&#x20;
* `SetScale(Transform reference)` — Sets the local scale to match another Transform.&#x20;
* `SetScale(float x, float y, float z)` — Sets the local scale using explicit X, Y, Z values.
* `ResetScale()` — Resets the local scale to (1,1,1).&#x20;
* `RoundScale(int decimals)` — Rounds each axis of the local scale to the specified number of decimals.

Axis:

* `Set/Get ScaleX()`
* `Set/Get ScaleY()`
* `Set/Get ScaleZ()`
* `Set/Get ScaleXY()`
* `Set/Get ScaleXZ()`
* `Set/Get ScaleYZ()`

***

#### **Distance To**

* `DistanceTo(Transform target)` — Returns the world distance between this Transform and another Transform.
* `DistanceTo(GameObject target)` — Returns the world distance between this Transform and a GameObject.
* `DistanceTo(Vector3 targetPosition)` — Returns the world distance between this Transform and a specified position in 3D space.
* `DistanceTo2D(Transform target)` — Returns the 2D distance between this Transform and another Transform in the XY plane.
* `DistanceTo2D(GameObject target)` — Returns the 2D distance between this Transform and a GameObject in the XY plane.
* `DistanceTo2D(Vector3 targetPosition)` — Returns the 2D distance between this Transform and a specified position in the XY plane.

***

#### **Sqr Distance To**

* `SqrDistanceTo(Transform target)` — Returns the squared world distance between this Transform and another Transform.
* `SqrDistanceTo(GameObject target)` — Returns the squared world distance between this Transform and a GameObject.
* `SqrDistanceTo(Vector3 targetPosition)` — Returns the squared world distance between this Transform and a specified position in 3D space.
* `SqrDistanceTo2D(Transform target)` — Returns the squared 2D distance between this Transform and another Transform in the XY plane.
* `SqrDistanceTo2D(GameObject target)` — Returns the squared 2D distance between this Transform and a GameObject in the XY plane.
* `SqrDistanceTo2D(Vector2 targetPosition)` — Returns the squared 2D distance between this Transform and a specified position in the XY plane.

***

#### **Is Within Distance**

* `IsWithinDistance(Transform target, float maxDistance)` — Checks if within distance of a Transform.&#x20;
* `IsWithinDistance(GameObject target, float maxDistance)` — Checks if within distance of a GameObject.&#x20;
* `IsWithinDistance(Vector3 targetPosition, float maxDistance)` — Checks if within distance of a position.

***

#### **Direction To**

* `DirectionTo(Transform target)` — Returns a normalized direction vector from this Transform to a target Transform in world space.
* `DirectionTo(GameObject target)` — Returns a normalized direction vector from this Transform to a target GameObject in world space.
* `DirectionTo(Vector3 targetPosition)` — Returns a normalized direction vector from this Transform to a specific world position.
* `DirectionTo2D(Transform target)` — Returns a normalized 2D direction vector from this Transform to another Transform in the XY plane.
* `DirectionTo2D(GameObject target)` — Returns a normalized 2D direction vector from this Transform to a GameObject in the XY plane.
* `DirectionTo2D(Vector2 targetPosition)` — Returns a normalized 2D direction vector from this Transform to a specific 2D position in the XY plane.

***

#### **Angle To**

* `AngleTo(Transform target)` — Returns the angle in degrees between this Transform's forward direction and the direction to a target Transform in world space.
* `AngleTo(GameObject target)` — Returns the angle in degrees between this Transform's forward direction and the direction to a target GameObject in world space.
* `AngleTo(Vector3 targetPosition)` — Returns the angle in degrees between this Transform's forward direction and the direction to a specific world position.
* `AngleTo2D(Transform target)` — Returns the angle in degrees between this Transform's forward direction (assumes 'up' as forward) and the direction to a specific 2D position in the XY plane.
* `AngleTo2D(GameObject target)` — Returns the angle in degrees between this Transform's forward direction (assumes 'up' as forward) and the direction to a target Transform in the XY plane.
* `AngleTo2D(Vector2 targetPosition)` — Returns the angle in degrees between this Transform's forward direction (assumes 'up' as forward) and the direction to a target GameObject in the XY plane.

***

#### **Closest/Furthest Transform**

* `ClosestTransform(IEnumerable<Transform> targets)` — Returns the closest Transform from a collection.&#x20;
* `ClosestTransform(IEnumerable<GameObject> targets)` — Returns the closest Transform from a GameObject collection.&#x20;
* `FurthestTransform(IEnumerable<Transform> targets)` — Returns the furthest Transform from a collection.&#x20;
* `FurthestTransform(IEnumerable<GameObject> targets)` — Returns the furthest Transform from a GameObject collection.

***

#### **Spatial Checks (Above/Below/Left/Right/Front/Back)**

* `IsAbove(Transform other, float tolerance = 0f)` — Checks if above another Transform.&#x20;
* `IsBelow(Transform other, float tolerance = 0f)` — Checks if below another Transform.&#x20;
* `IsLeftOf(Transform other, float tolerance = 0f)` — Checks if left of another Transform.&#x20;
* `IsRightOf(Transform other, float tolerance = 0f)` — Checks if right of another Transform.&#x20;
* `IsInFrontOf(Transform other, float tolerance = 0f)` — Checks if in front of another Transform.&#x20;
* `IsBehind(Transform other, float tolerance = 0f)` — Checks if behind another Transform.&#x20;
* `IsVisibleFrom(Camera camera)` — Checks if visible from the specified Camera.

***

#### **Root**

* `GetRoot()` — Returns the root Transform of this hierarchy.
* `IsRoot()` — Checks if this Transform is the root of its hierarchy.

***

#### **Get Parent**

* `GetParent()` — Returns the immediate parent of this Transform, or null if there is no parent.&#x20;
* `GetFirstActiveParent()` — Returns the first active parent in the hierarchy, or null if none are active.&#x20;
* `GetFirstInactiveParent()` — Returns the first inactive parent in the hierarchy, or null if none are inactive.
* `GetParentHierarchy()` — Returns a list of all parent Transforms from immediate to top-most.&#x20;
* `GetPath()` — Returns the full hierarchy path of this Transform in the scene (e.g., "Root/Child/This").&#x20;

***

#### **Get Child**

* `GetFirstActiveChild()` — Returns the first active child of this Transform, or null if none are active.&#x20;
* `GetFirstInactiveChild()` — Returns the first inactive child of this Transform, or null if none are inactive.&#x20;
* `HasChild(string name)` — Checks if this Transform has a child with the specified name.

***

#### **Get Children**

* `GetActiveChildren()` — Returns a list of all active children of this Transform.&#x20;
* `GetInactiveChildren()` — Returns a list of all inactive children of this Transform.

***

#### **Modify Child**

* `EnableChild(int index)` — Enables the child at the specified index of this Transform.&#x20;
* `DisableChild(int index)` — Disables the child at the specified index of this Transform.&#x20;
* `OnlyEnableChild(int index)` — Enables only the child at the specified index and disables all others.&#x20;
* `OnlyDisableChild(int index)` — Disables only the child at the specified index and enables all others.&#x20;
* `ForEachChild(Action<Transform> action)` — Executes a specified action for each direct child of this Transform.&#x20;
* `ResetChildPositions(bool recursive = false)` — Resets world positions of all direct children to Vector3.zero; recursive optional.&#x20;
* `ResetChildLocalPositions(bool recursive = false)` — Resets local positions of all direct children to Vector3.zero; recursive optional.&#x20;
* `ResetChildRotations(bool recursive = false)` — Resets world rotations of all direct children to Quaternion.identity; recursive optional.&#x20;
* `ResetChildLocalRotations(bool recursive = false)` — Resets local rotations of all direct children to Quaternion.identity; recursive optional.&#x20;
* `ResetChildScales(bool recursive = false)` — Resets local scales of all direct children to Vector3.one; recursive optional.&#x20;
* `InstantiateAsChild(GameObject prefab)` — Instantiates a prefab as a child of this Transform.&#x20;
* `DestroyChild(int index)` — Destroys the child at the specified index of this Transform.&#x20;
* `DestroyChild(string name)` — Destroys the first child of this Transform with the specified name.

***

#### **Modify Children**

* `AddChildren(IEnumerable<Transform> children)` — Sets the parent of each Transform in the collection to this Transform.&#x20;
* `AddChildren(IEnumerable<GameObject> children)` — Sets the parent of each GameObject in the collection to this Transform.&#x20;
* `EnableChildren()` — Activates all direct children of this Transform.&#x20;
* `DisableChildren()` — Deactivates all direct children of this Transform.&#x20;
* `DestroyChildren()` — Destroys all direct children of this Transform.
