MathUtils
This class provides some math functionality that is useful for 3d maths
Static methods
Method |
Description |
---|---|
A frame rate independent alternative to damping using Mathf.Lerp() |
|
A frame rate independent alternative to damping using Vector3.Lerp() |
|
A frame rate independent alternative to damping using Quaternion.Lerp() |
|
A frame rate independent alternative to damping using Quaternion.Slerp() |
|
Given a line segment S and point P, get the point on S that is closest to P. |
|
Given a line segment S and point P, get the point on S that is closest to P. |
|
Given a line L and point P, get the point on L that is closest to P. |
|
Given a line L and point P, get the point on L that is closest to P. |
|
Returns the look rotation like Quaternion.LookRotation(), but with the up vector being fully constrained instead of the forward vector. |
Details
-
class MathUtils
-
static float Damp(float current, float target, float smoothing, float deltaTime)
A frame rate independent alternative to damping using Mathf.Lerp()
-
static Vector3 Damp(Vector3 current, Vector3 target, float smoothing, float deltaTime)
A frame rate independent alternative to damping using Vector3.Lerp()
-
static Quaternion DampLinear(Quaternion current, Quaternion target, float smoothing, float deltaTime)
A frame rate independent alternative to damping using Quaternion.Lerp()
-
static Quaternion DampSpherical(Quaternion current, Quaternion target, float smoothing, float deltaTime)
A frame rate independent alternative to damping using Quaternion.Slerp()
-
static Vector3 LineSegmentVsPointClosest(Vector3 segmentStart, Vector3 segmentEnd, Vector3 point)
Given a line segment S and point P, get the point on S that is closest to P.
-
static float LineSegmentVsPointClosestT(Vector3 segmentStart, Vector3 segmentEnd, Vector3 point)
Given a line segment S and point P, get the point on S that is closest to P. Returns the point as a value T, where point = Lerp(start(S), end(S), T)
-
static Vector3 LineVsPointClosest(Vector3 lineOrigin, Vector3 lineDirection, Vector3 point)
Given a line L and point P, get the point on L that is closest to P.
-
static float LineVsPointClosestT(Vector3 lineOrigin, Vector3 lineDirection, Vector3 point)
Given a line L and point P, get the point on L that is closest to P. Returns the point as a value T, where point = origin(L) + direction(L) * T
-
static Quaternion LookRotationConstrainUp(Vector3 forward, Vector3 up)
Returns the look rotation like Quaternion.LookRotation(), but with the up vector being fully constrained instead of the forward vector.
-
static float Damp(float current, float target, float smoothing, float deltaTime)