UltimateXR.Core.Math Namespace


Public classUxrAxis Class that allows to have formatted axes (A combo box with X, Y, Z strings) instead of numerical fields. It also allows conversion from and to integers and Vector3 types. See the UxrAxisPropertyDrawer editor class for the integration with Unity Editor.
Public classUxrMathUtils Contains math computations involving elements that do not belong to a specific class. Most math is available through extensions classes in namespaces such as UltimateXR.Extensions.System.Math or UltimateXR.Extensions.Unity.Math. Math related to animation is also available through classes in namespaces such as UltimateXR.Animation.IK, UltimateXRAnimation.Interpolation or UltimateXR.Animation.Splines. This class will contain math functionality that cannot be assigned to any extensions class.
Public classUxrUniversalLocalAxes

Different parts of the framework need to deal with axes. These algorithms like IK solvers or avatar components need to know exactly where ‘forward’ is or which axis points to the right in avatar-space. Since modelling packages and artists may rig objects using arbitrary coordinate systems we need a way to perform operations in a way that takes this into account. The code also needs to remain readable since many math operations may increase complexity. Readability is favoured here over performance.

This class allows to transform from arbitrary coordinate systems to a universal one where different rotations can then be performed and vice versa. One example would be a finger bone curl. We create the convention that forward is the axis from one bone to the next, up points upwards and right would be the axis around which the bone should rotate to curl. This is OK but now we face the problem that different modelling packages or artists rig fingers in completely different ways using all varieties of axis systems. The purpose of this class is to help creating a system where operations can be performed in this universal system to follow our conventions and then rotated “back” to any kind of coordinate system afterwards.

tl;dr A class that helps us operate with rotations and angles of an object no matter which convention the 3D assets use. We call ‘Universal’ the coordinate system we use as convention for our computations, we then can use UniversalToActualAxesRotation to transform the object back to its actual axes. This way our computations do not care which coordinate system the assets use, and is essential to simplify operations like inverse kinematics or angle computations.