This project is archived—no longer maintained. So long, and thanks for all the fish!
Includes math functions missing from DOTS.
This requires Unity editor 2019.3 or greater. Copy one of the below Git URLs:
- HTTPS:
https://github.com/reeseschultz/ReeseUnityDemos.git#math - SSH:
[email protected]:reeseschultz/ReeseUnityDemos.git#math
Then go to Window ⇒ Package Manager in the editor. Press the + symbol in the top-left corner, and then click on Add package from git URL. Paste the text you copied and finally click Add.
Be sure to import Reese.Math in any file where you intend to use these extensions!
| Method | Return Type | Description |
|---|---|---|
MultiplyPoint3x4(float3 point) |
float3 |
Changes the basis of a point with the given transform. |
| Method | Return Type | Description |
|---|---|---|
ref MoveTowards(float3 to, float maxDelta) |
float3 |
Moves from a point to another point by the max delta (moves less than the max delta if target is closer than the max delta). |
MultiplyPoint3x4(float4x4 transform) |
float3 |
Changes the basis of a point with the given transform. |
ToLocal(LocalToWorld localToWorld) |
float3 |
Transforms a point from world to local space. |
ToWorld(LocalToWorld localToWorld) |
float3 |
Transforms a point from local to world space. |
ProjectOnPlane(float3 normal) |
float3 |
Projects a float3 vector onto a planar normal. |
AxialReplacement(float3 replacingVector, float3 axis) |
float3 |
Component-wise replacement along the provided axes. |
InvertToUnsignedAxis() |
float3 |
Inverts to an unsigned axis. For example, (-1, 0, 1) becomes (0, 1, 0). |
AngleRadians(float3 to) |
float |
Returns the angle between two float3s in radians. |
AngleDegrees(float3 to) |
float |
Returns the angle between two float3s in degrees. |
SignedAngleRadians(float3 to, float3 axis) |
float |
Returns the signed angle between two float3s in radians about the given axis. |
SignedAngleDegrees(float3 to, float3 axis) |
float |
Returns the signed angle between two float3s in degrees about the given axis. |
Angle360(float3 to, float3 right) |
float |
Returns the angle between two float3s ranging between 0 and 360 degrees. |
FromToRotation(float3 to) |
quaternion |
Rotates from one rotation to another. |
GetWorldRotationToTarget(LocalToWorld localToWorld, float3 planarAxis = default) |
quaternion |
Gets the rotation to the target in world space. |
| Method | Return Type | Description |
|---|---|---|
ToLocal(LocalToWorld localToWorld) |
quaternion |
Transforms a quaternion from world to local space. |
ToWorld(LocalToWorld localToWorld) |
quaternion |
Transforms a quaternion from local to world space. |
RotateTowardsRadians(quaternion to, float deltaRadians) |
quaternion |
Returns a quaternion interpolated by delta radians. |
RotateTowardsDegrees(quaternion to, float deltaDegrees) |
quaternion |
Returns a quaternion interpolated by delta degrees. |
AngleRadians(quaternion to) |
float |
Returns the angle between two quaternions in radians. |
AngleDegrees(quaternion to) |
float |
Returns the angle between two quaternions in degrees. |
All contributions to this repository are licensed under MIT.