![]() |
Lemmings
Remappable Gestures For Unity
|
A struct for managing and interpreting a Vector3 value, including normalization, projection, direction checks, and remapping. More...
Inherits Lemmings.ILemmingConverter.
Public Member Functions | |
| LemmingVectorizer (Vector3 raw, float minMagnitude, float maxMagnitude) | |
| Constructs a new LemmingVectorizer. | |
| Vector3 | ProjectOnto (Vector3 direction) |
| Projects this vector onto another and returns the scalar projection (dot product). | |
| Vector3 | ProjectOnto (Quaternion rotation) |
| Projects this vector onto the forward direction of a rotation and returns the scalar projection (dot product). | |
| float | AngleTo (Vector3 other) |
| Returns the angle in degrees between this vector and another vector. | |
| float | AngleTo (Quaternion rotation) |
| Returns the angle in degrees between this vector and the forward direction of a rotation. | |
| float | SignedAngle (Vector3 other, Vector3 axis) |
| Returns the signed angle between this vector and another, relative to a given axis. | |
| float | ToFloatRange (float outMin, float outMax) |
| Remaps the normalized magnitude to a float within a custom range. | |
| int | ToIntRange (int minimum, int maximum) |
| Remaps the normalized value to an integer range. | |
| int | ToIndex (int arraySize) |
| Remaps the normalized magnitude to an integer index for an array. | |
| string | ToLabel (string[] labels) |
| Maps the current value to a label from a list using normalized indexing. | |
| T | ToEnum< T > () |
| Maps the current value to a member of the specified enum using normalized indexing. | |
| Vector3 | ToVector (Vector3 a, Vector3 b) |
| Interpolates between two vectors using the normalized magnitude. | |
| Quaternion | ToQuaternion (Quaternion a, Quaternion b) |
| Interpolates between two rotations using the normalized magnitude. | |
| Quaternion | ToRotationAroundAxis (Vector3 axis, float minAngle, float maxAngle) |
| Creates a rotation around the given axis based on the normalized magnitude. | |
| Quaternion | ToLookRotation (Vector3 up) |
| Converts this vector into a look rotation. | |
| float | ToCurve (AnimationCurve curve) |
| Evaluates the normalized magnitude on an AnimationCurve. | |
| 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. | |
| bool | IsFacingObject (Transform target, float threshold=0.95f) |
| Checks if this vector is facing toward a given Transform. | |
| bool | IsFacingObject (GameObject target, float threshold=0.95f) |
| Checks if this vector is facing toward a given GameObject. | |
| override string | ToString () |
| Returns a string representation of the vector, its magnitude, and normalized value. | |
| void | SetRaw (Vector3 newRaw) |
| Sets a new raw vector value. | |
| void | SetRange (float newMax, float newMin) |
| Sets a new maximum magnitude for normalization. | |
| void | Reset (Vector3 newRaw, float newMax, float newMin) |
| Resets the vector and maximum magnitude. | |
Data Fields | |
| Vector3 | raw |
| The raw vector input. | |
| float | maxMagnitude |
| The maximum expected magnitude used for normalization. | |
| float | minMagnitude |
| The minimum expected magnitude used for normalization. | |
Properties | |
| object | Raw [get] |
| float | Normalized [get] |
| Returns the magnitude of the vector normalized to the range [0, 1]. | |
| bool | Over [get] |
| Returns true if the distance is greater than the maximum Magnitude set. | |
| bool | InRange [get] |
| Returns true if the magnitude is within the specified range. | |
| bool | Under [get] |
| Returns true if the distance is less than the minimum Magnitude set. | |
| Vector3 | Direction [get] |
| Returns the normalized direction of the vector. | |
| bool | IsZero [get] |
| Returns true if the vector is (0, 0, 0). | |
| 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 a Vector3 value, including normalization, projection, direction checks, and remapping.
|
inline |
Constructs a new LemmingVectorizer.
| raw | The input vector. |
| maxMagnitude | The maximum magnitude for normalization. |
| minMagnitude | The minimum magnitude for normalization |
|
inline |
Returns the angle in degrees between this vector and the forward direction of a rotation.
| rotation | The rotation whose forward vector is used for comparison. |
|
inline |
Returns the angle in degrees between this vector and another vector.
| other | The vector to compare against. |
|
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 vector is facing toward a given GameObject.
| target | The target GameObject. |
| threshold | Dot product threshold (default = 0.95). |
|
inline |
Checks if this vector is facing toward a given Transform.
| target | The target transform. |
| threshold | Dot product threshold (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 |
Projects this vector onto the forward direction of a rotation and returns the scalar projection (dot product).
| rotation | The rotation whose forward direction is used for projection. |
|
inline |
Projects this vector onto another and returns the scalar projection (dot product).
| direction | The direction to project onto. |
|
inline |
Resets the vector and maximum magnitude.
| newRaw | New vector value. |
| newMax | New max magnitude. |
| newMin | New min magnitude. |
|
inline |
Sets a new maximum magnitude for normalization.
| newMax | The new max magnitude. |
| newMin | New min magnitude. |
|
inline |
Sets a new raw vector value.
| newRaw | The new vector value. |
|
inline |
Returns the signed angle between this vector and another, relative to a given axis.
| other | The other vector. |
| axis | The axis around which to measure the angle. |
|
inline |
Evaluates the normalized magnitude on an AnimationCurve.
| curve | The curve to evaluate. |
Implements Lemmings.ILemmingConverter.
|
inline |
Maps the current value to a member of the specified enum using normalized indexing.
| T | The enum type to map to. |
| T | : | Enum |
|
inline |
Remaps the normalized magnitude to a float within a custom range.
| outMin | The minimum output value. |
| outMax | The maximum output value. |
|
inline |
Remaps the normalized magnitude to an integer index for an array.
| arraySize | The size of 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 |
Converts this vector into a look rotation.
| up | The up vector to use for rotation stability. |
|
inline |
Interpolates between two rotations using the normalized magnitude.
| a | Start rotation. |
| b | End rotation. |
|
inline |
Creates a rotation around the given axis based on the normalized magnitude.
| axis | Axis to rotate around (should be normalized). |
| minAngle | Minimum rotation in degrees. |
| maxAngle | Maximum rotation in degrees. |
|
inline |
Interpolates between two vectors using the normalized magnitude.
| 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 magnitude is within the specified range.
Implements Lemmings.ILemmingConverter.
|
get |
Returns the magnitude of the vector normalized to the range [0, 1].
Implements Lemmings.ILemmingConverter.
|
get |
Returns true if the distance is greater than the maximum Magnitude set.
Implements Lemmings.ILemmingConverter.
|
get |
Implements Lemmings.ILemmingConverter.
|
get |
Returns true if the distance is less than the minimum Magnitude set.
Implements Lemmings.ILemmingConverter.