Represents a series of UnityEngine.Transform extension methods.
More...
|
static void | LoadMatrix (this Transform transform, Matrix4x4 matrix, bool local=true) |
| Assigns a UnityEngine.Matrix4x4 into UnityEngine.Transform components. More...
|
|
static Bounds | EncapsulateBounds (this Transform transform) |
| Encapsulates the UnityEngine.Transform childs bounds on new bounds. More...
|
|
static Transform | FindDeepChild (this Transform transform, string name, bool endsWith=false) |
|
static void | DestroyChildren (this Transform transform, bool destroyImmediate=false) |
| Destroys the children UnityEngine.GameObject of this UnityEngine.Transform. More...
|
|
Represents a series of UnityEngine.Transform extension methods.
◆ DestroyChildren()
static void TriLib.TransformExtensions.DestroyChildren |
( |
this Transform |
transform, |
|
|
bool |
destroyImmediate = false |
|
) |
| |
|
static |
Destroys the children UnityEngine.GameObject of this UnityEngine.Transform.
- Parameters
-
transform | UnityEngine.Transform to destroy children from. |
destroyImmediate | When true destroy children immediately. |
◆ EncapsulateBounds()
static Bounds TriLib.TransformExtensions.EncapsulateBounds |
( |
this Transform |
transform | ) |
|
|
static |
Encapsulates the UnityEngine.Transform childs bounds on new bounds.
- Parameters
-
transform | UnityEngine.Transform to encapsulate. |
- Returns
- Encapsulated UnityEngine.Bounds.
var bounds = myTransform.EncapsulateBounds();
var boundRadius = bounds.extents.magnitude;
var distance = (boundRadius / (2.0f * Mathf.Tan(0.5f * camera.fieldOfView * Mathf.Deg2Rad))) * radius;
if (
System.Single.IsNaN(distance))
{
return;
}
camera.farClipPlane = distance * 2f;
camera.transform.position = new Vector3(bounds.center.x, bounds.center.y, bounds.center.z + distance);
camera.transform.LookAt(bounds.center);
◆ FindDeepChild()
static Transform TriLib.TransformExtensions.FindDeepChild |
( |
this Transform |
transform, |
|
|
string |
name, |
|
|
bool |
endsWith = false |
|
) |
| |
|
static |
- Parameters
-
transform | UnityEngine.Transform to search in. |
name | Name of the object to search for. |
endsWith | When true, search for transforms that ends with 'name' value. |
- Returns
- The UnityEngine.Transform if found, otherwise, null.
◆ LoadMatrix()
static void TriLib.TransformExtensions.LoadMatrix |
( |
this Transform |
transform, |
|
|
Matrix4x4 |
matrix, |
|
|
bool |
local = true |
|
) |
| |
|
static |
Assigns a UnityEngine.Matrix4x4 into UnityEngine.Transform components.
- Parameters
-
transform | UnityEngine.Transform to assign the UnityEngine.Matrix4x4. |
matrix | UnityEngine.Matrix4x4 to assign. |
local | If true, copies the UnityEngine.Matrix4x4 components to UnityEngine.Transform local components. Otherwise, copies the UnityEngine.Matrix4x4 components to UnityEngine.Transform world components. |
var myMatrix = Matrix4x4.TRS(new Vector3(0f, 0f, 100f), Quaternion.Euler(0f, 90f, 0f), Vector3.one);
myGameObject.transform.LoadMatrix(myMatrix);
The documentation for this class was generated from the following file: