MF_StaticUtilities
Various utilities.
Public Class MFmath
Public Methods
Mod : int ( a : int, b : int )
Returns the modulo. Not to be confused with the ‘%’ operator which is not modulo, but rather, the remainder operator in C#. Mod also works with negative integers.
AngleSigned : float ( v1 : Vector3, v2 : Vector3, axis : Vector3 )
Finds the angle between two Vector3s relative to an axis. This returns positive and negative angles. If the axis is up, and v2 is to the left, the result is negative. If it’s to the right, it returns a positive angle.
axis must be a normalized vector.
Public Class UtilityMF
Public Static Variables
Public Methods
stopwatch : Stopwatch
A static instance of System.Diagnostics.Stopwatch()
This can be useful for debugging and benchmarking from multiple classes needing access to the same Stopwatch.
GetComponentInParent : <T> ( location : Transform )
Similar to Component.GetComponentInParent, but will return the component even if it appears on an inactive object.
Starting at location, recursively moves up the hierarchy tree looking for a component of type T.
Will return the found component, or return null if none was found.
RecursiveParentTransformSearch : bool ( target : Transform, location : Transform )
Beginning at location, moves up the tree searching for target transform.
FindColliderBoundsSize : float ( trans : Transform )
FindColliderBoundsSize : float ( trans : Transform, checkChildren : bool )
Finds the average dimension of the bounds of first collider found on trans. Be aware that bounds size in Unity is world axis-aligned. That is, it is never rotated with the object. So on an angled object, a bounds size can be larger than the side of your object.
checkChildren is optional and defaults to false. If true, when no collider is found on the object, its children will be checked until the first a collider is found. Then if still no collider found, it will check all of the children’s children for the first collider.
In either case, if no collider is eventually found, it will return 0.
BuildArrayFromChildren : Transform[] ( trans : Transform )
Will return an array of the transforms that appear as the children of trans.
If trans has no children, trans will instead be used as a single array element.
If trans is null, the array will have 0 elements.
Various utilities.
Public Class MFmath
Public Methods
Mod : int ( a : int, b : int )
Returns the modulo. Not to be confused with the ‘%’ operator which is not modulo, but rather, the remainder operator in C#. Mod also works with negative integers.
AngleSigned : float ( v1 : Vector3, v2 : Vector3, axis : Vector3 )
Finds the angle between two Vector3s relative to an axis. This returns positive and negative angles. If the axis is up, and v2 is to the left, the result is negative. If it’s to the right, it returns a positive angle.
axis must be a normalized vector.
Public Class UtilityMF
Public Static Variables
Public Methods
stopwatch : Stopwatch
A static instance of System.Diagnostics.Stopwatch()
This can be useful for debugging and benchmarking from multiple classes needing access to the same Stopwatch.
GetComponentInParent : <T> ( location : Transform )
Similar to Component.GetComponentInParent, but will return the component even if it appears on an inactive object.
Starting at location, recursively moves up the hierarchy tree looking for a component of type T.
Will return the found component, or return null if none was found.
RecursiveParentTransformSearch : bool ( target : Transform, location : Transform )
Beginning at location, moves up the tree searching for target transform.
FindColliderBoundsSize : float ( trans : Transform )
FindColliderBoundsSize : float ( trans : Transform, checkChildren : bool )
Finds the average dimension of the bounds of first collider found on trans. Be aware that bounds size in Unity is world axis-aligned. That is, it is never rotated with the object. So on an angled object, a bounds size can be larger than the side of your object.
checkChildren is optional and defaults to false. If true, when no collider is found on the object, its children will be checked until the first a collider is found. Then if still no collider found, it will check all of the children’s children for the first collider.
In either case, if no collider is eventually found, it will return 0.
BuildArrayFromChildren : Transform[] ( trans : Transform )
Will return an array of the transforms that appear as the children of trans.
If trans has no children, trans will instead be used as a single array element.
If trans is null, the array will have 0 elements.