![]() |
Lemmings
Remappable Gestures For Unity
|
A struct for managing and interpreting Quaternion rotations, including angular comparison, interpolation, remapping, and directional checks. More...
Inherits Lemmings.ILemmingConverter.
Public Member Functions | |
| LemmingRotater (Quaternion raw, float maxAngle, float minAngle) | |
| Constructs a new LemmingRotater with a rotation and max angle. | |
| float | AngleTo (Quaternion target) |
| Returns the angular difference in degrees between this rotation and another quaternion. | |
| float | AngleTo (Vector3 direction) |
| Returns the angular difference in degrees between the direction this quaternion faces and a world-space direction vector. | |
| Quaternion | ToQuaternion (Quaternion a, Quaternion b) |
| Interpolates between two quaternions based on the normalized value. | |
| Vector3 | ToVector (Vector3 a, Vector3 b) |
| Interpolates between two vectors using the normalized factor. | |
| float | ToFloatRange (float outMin, float outMax) |
| Remaps the normalized value to a float between outMin and outMax. | |
| int | ToIntRange (int minimum, int maximum) |
| Remaps the normalized value to an integer range. | |
| string | ToLabel (string[] labels) |
| Maps the current value to a label from a list using normalized indexing. | |
| float | ToCurve (AnimationCurve curve) |
| Evaluates the normalized value on a Unity AnimationCurve. | |
| Vector3 | Axis () |
| Returns the axis of rotation from the stored quaternion. | |
| float | Angle () |
| Returns the rotation angle (in degrees) represented by the quaternion. | |
| Vector3 | ProjectOnto (Vector3 direction) |
| Projects the forward direction of this rotation onto the given vector. | |
| Vector3 | ProjectOnto (Quaternion rotation) |
| Projects the forward direction of this rotation onto another rotation's forward direction. | |
| bool | IsMatchingRotation (Quaternion target, float threshold=0.95f) |
| Checks whether this rotation is facing approximately the same direction as another. | |
| Quaternion | ToRotationAroundAxis (Vector3 axis, float minAngle, float maxAngle) |
| Converts the normalized rotation value to a rotation around the given axis using a remapped angle range. | |
| bool | IsFacingPosition (Vector3 targetPosition, Vector3 currentPosition, float threshold=0.95f) |
| Checks if this rotation is approximately facing toward a given world position. | |
| bool | IsFacingDirection (Vector3 direction, float threshold=0.95f) |
| Checks if the rotation is pointed towards a given direction using a threshold. | |
| int | ToIndex (int arraySize) |
| Maps the normalized value to an array index. | |
| T | ToEnum< T > () |
| Maps the normalized value to an enum value based on index. | |
| override string | ToString () |
| Returns a formatted string summarizing the raw rotation, angle, and normalized value. | |
| void | SetRaw (Quaternion newRotation) |
| Sets the internal rotation to a new value. | |
| void | SetRange (float newMax, float newMin) |
| Sets the maxAngle used for normalization. | |
| void | Reset (Quaternion newRotation, float newMaxAngle, float newMinAngle) |
| Resets the internal rotation and maxAngle to new values. | |
Properties | |
| object | Raw [get] |
| The raw Quaternion value representing a 3D rotation. | |
| float | Normalized [get] |
| Returns the normalized value between minAngle and maxAngle. | |
| bool | Over [get] |
| Returns true if the angle is greater than the maximum angle set. | |
| bool | InRange [get] |
| Returns true if the angle is within the specified range. | |
| bool | Under [get] |
| Returns true if the angle is less than the maximum angle set. | |
| bool | IsZero [get] |
| Returns true if the quaternion represents the identity rotation (no rotation). | |
| Vector3 | Direction [get] |
| Returns the direction the quaternion is facing. | |
| float | AsAxis [get] |
| This provides the normalized value in a range of -1 to 1, useful for input mapping and relative values. | |
A struct for managing and interpreting Quaternion rotations, including angular comparison, interpolation, remapping, and directional checks.
Quaternions represent 3D rotation in a stable, interpolation-friendly form. Use them for smooth orientation tracking, angle comparisons, and gesture dynamics. They avoid gimbal lock and provide consistent behavior when interpolating or blending.
|
inline |
Constructs a new LemmingRotater with a rotation and max angle.
| raw | The rotation to store. |
| maxAngle | The angle to use for normalization reference. |
|
inline |
Returns the rotation angle (in degrees) represented by the quaternion.
|
inline |
Returns the angular difference in degrees between this rotation and another quaternion.
| target | The target rotation to compare to. |
|
inline |
Returns the angular difference in degrees between the direction this quaternion faces and a world-space direction vector.
| direction | The world-space direction to compare against. |
|
inline |
Returns the axis of rotation from the stored quaternion.
|
inline |
Checks if the rotation is pointed towards a given direction using a threshold.
| direction | Direction to check against |
| threshold | The dot product threshold for detection (default = 0.95) |
|
inline |
Checks if this rotation is approximately facing toward a given world position.
| targetPosition | The position to face. |
| currentPosition | The current position. |
| threshold | The dot product threshold (default = 0.95). |
|
inline |
Checks whether this rotation is facing approximately the same direction as another.
| target | The target rotation to compare to. |
| threshold | The dot product threshold to consider as aligned (default = 0.95). |
|
inline |
Projects the forward direction of this rotation onto another rotation's forward direction.
| rotation | The rotation whose direction to project onto. |
|
inline |
Projects the forward direction of this rotation onto the given vector.
| direction | The direction to project onto. |
|
inline |
Resets the internal rotation and maxAngle to new values.
| newRotation | The new Quaternion value. |
| newMaxAngle | The new maximum angle. |
///
| newMinAngle | The new minimum angle. |
|
inline |
Sets the maxAngle used for normalization.
| newMax | The new maximum angle. |
///
| newMin | The new minimum angle. |
|
inline |
Sets the internal rotation to a new value.
| newRotation | The new Quaternion rotation. |
|
inline |
Evaluates the normalized value on a Unity AnimationCurve.
| curve | The curve to evaluate. |
Implements Lemmings.ILemmingConverter.
|
inline |
Maps the normalized value to an enum value based on index.
| T | The enum type to convert to. |
| T | : | Enum |
|
inline |
Remaps the normalized value to a float between outMin and outMax.
| outMin | Minimum output value. |
| outMax | Maximum output value. |
|
inline |
Maps the normalized value to an array index.
| arraySize | The total number of elements in the array. |
|
inline |
Remaps the normalized value to an integer range.
| minimum | Minimum integer output value. |
| maximum | Maximum integer output value. |
|
inline |
Maps the current value to a label from a list using normalized indexing.
| labels | An array of string labels. |
|
inline |
Interpolates between two quaternions based on the normalized value.
| a | The start rotation. |
| b | The end rotation. |
|
inline |
Converts the normalized rotation value to a rotation around the given axis using a remapped angle range.
| axis | The axis to rotate around (e.g., Vector3.up). |
| minAngle | The minimum angle in degrees. |
| maxAngle | The maximum angle in degrees. |
|
inline |
Returns a formatted string summarizing the raw rotation, angle, and normalized value.
|
inline |
Interpolates between two vectors using the normalized factor.
| a | The start vector. |
| b | The end vector. |
|
get |
This provides the normalized value in a range of -1 to 1, useful for input mapping and relative values.
Implements Lemmings.ILemmingConverter.
|
get |
Returns true if the angle is within the specified range.
Implements Lemmings.ILemmingConverter.
|
get |
Returns the normalized value between minAngle and maxAngle.
Implements Lemmings.ILemmingConverter.
|
get |
Returns true if the angle is greater than the maximum angle set.
Implements Lemmings.ILemmingConverter.
|
get |
The raw Quaternion value representing a 3D rotation.
Implements Lemmings.ILemmingConverter.
|
get |
Returns true if the angle is less than the maximum angle set.
Implements Lemmings.ILemmingConverter.