| 
    NiceTouch v2.2
    
   | 
 
Math helpers More...
Static Public Member Functions | |
| static void | Spring (ref float currentValue, float targetValue, ref float velocity, float damping, float frequency, float deltaTime) | 
| Springs a float towards a target value  More... | |
| static void | Spring (ref Vector2 currentValue, Vector2 targetValue, ref Vector2 velocity, float damping, float frequency, float deltaTime) | 
| Springs a Vector2 towards a target value  More... | |
| static void | Spring (ref Vector3 currentValue, Vector3 targetValue, ref Vector3 velocity, float damping, float frequency, float deltaTime) | 
| Springs a Vector3 towards a target value  More... | |
| static void | Spring (ref Vector4 currentValue, Vector4 targetValue, ref Vector4 velocity, float damping, float frequency, float deltaTime) | 
| Springs a Vector4 towards a target value  More... | |
| static float | Lerp (float value, float target, float rate, float deltaTime) | 
| Lerps a float towards a target at the specified rate  More... | |
| static Vector2 | Lerp (Vector2 value, Vector2 target, float rate, float deltaTime) | 
| Lerps a Vector2 towards a target at the specified rate  More... | |
| static Vector3 | Lerp (Vector3 value, Vector3 target, float rate, float deltaTime) | 
| Lerps a Vector3 towards a target at the specified rate  More... | |
| static Vector4 | Lerp (Vector4 value, Vector4 target, float rate, float deltaTime) | 
| Lerps a Vector4 towards a target at the specified rate  More... | |
| static Quaternion | Lerp (Quaternion value, Quaternion target, float rate, float deltaTime) | 
| Lerps a Quaternion towards a target at the specified rate  More... | |
| static Color | Lerp (Color value, Color target, float rate, float deltaTime) | 
| Lerps a Color towards a target at the specified rate  More... | |
| static Color32 | Lerp (Color32 value, Color32 target, float rate, float deltaTime) | 
| Lerps a Color32 towards a target at the specified rate  More... | |
| static float | Clamp (float value, float min, float max, bool clampMin, bool clampMax) | 
| Clamps a float between min and max, both bounds being optional and driven by clampMin and clampMax respectively  More... | |
| static float | RoundToNearestHalf (float a) | 
| Rounds a float to the nearest half value : 1, 1.5, 2, 2.5 etc  More... | |
| static Quaternion | LookAt2D (Vector2 direction) | 
| static Vector2 | Vector3ToVector2 (Vector3 target) | 
| Takes a Vector3 and turns it into a Vector2  More... | |
| static Vector3 | Vector2ToVector3 (Vector2 target) | 
| Takes a Vector2 and turns it into a Vector3 with a null z value  More... | |
| static Vector3 | Vector2ToVector3 (Vector2 target, float newZValue) | 
| Takes a Vector2 and turns it into a Vector3 with the specified z value  More... | |
| static Vector3 | RoundVector3 (Vector3 vector) | 
| Rounds all components of a Vector3.  More... | |
| static Vector2 | RandomVector2 (Vector2 minimum, Vector2 maximum) | 
| Returns a random Vector2 from 2 defined Vector2.  More... | |
| static Vector3 | RandomVector3 (Vector3 minimum, Vector3 maximum) | 
| Returns a random Vector3 from 2 defined Vector3.  More... | |
| static Vector2 | RandomPointOnCircle (float circleRadius) | 
| Returns a random point on the circle of the specified radius  More... | |
| static Vector3 | RandomPointOnSphere (float sphereRadius) | 
| Returns a random point on the sphere of the specified radius  More... | |
| static Vector3 | RotatePointAroundPivot (Vector3 point, Vector3 pivot, float angle) | 
| Rotates a point around the given pivot.  More... | |
| static Vector3 | RotatePointAroundPivot (Vector3 point, Vector3 pivot, Vector3 angle) | 
| Rotates a point around the given pivot.  More... | |
| static Vector3 | RotatePointAroundPivot (Vector3 point, Vector3 pivot, Quaternion quaternion) | 
| Rotates a point around the given pivot.  More... | |
| static Vector2 | RotateVector2 (Vector2 vector, float angle) | 
| Rotates a vector2 by the angle (in degrees) specified and returns it  More... | |
| static float | AngleBetween (Vector2 vectorA, Vector2 vectorB) | 
| Computes and returns the angle between two vectors, on a 360° scale  More... | |
| static float | AngleDirection (Vector3 vectorA, Vector3 vectorB, Vector3 up) | 
| Computes and returns the direction between two vector3, used to check if a vector is pointing left or right of another one  More... | |
| static float | DistanceBetweenPointAndLine (Vector3 point, Vector3 lineStart, Vector3 lineEnd) | 
| Returns the distance between a point and a line.  More... | |
| static Vector3 | ProjectPointOnLine (Vector3 point, Vector3 lineStart, Vector3 lineEnd) | 
| Projects a point on a line (perpendicularly) and returns the projected point.  More... | |
| static int | Sum (params int[] thingsToAdd) | 
| Returns the sum of all the int passed in parameters  More... | |
| static int | RollADice (int numberOfSides) | 
| Returns the result of rolling a dice of the specified number of sides  More... | |
| static bool | Chance (int percent) | 
| Returns a random success based on X% of chance.  More... | |
| static float | Approach (float from, float to, float amount) | 
| Moves from "from" to "to" by the specified amount and returns the corresponding value  More... | |
| static float | Remap (float x, float A, float B, float C, float D) | 
| Remaps a value x in interval [A,B], to the proportional value in interval [C,D]  More... | |
| static float | ClampAngle (float angle, float minimumAngle, float maximumAngle) | 
| Clamps the angle in parameters between a minimum and maximum angle (all angles expressed in degrees)  More... | |
| static float | RoundToDecimal (float value, int numberOfDecimals) | 
| static float | RoundToClosest (float value, float[] possibleValues, bool pickSmallestDistance=false) | 
| Rounds the value passed in parameters to the closest value in the parameter array  More... | |
| static Vector3 | DirectionFromAngle (float angle, float additionalAngle) | 
| Returns a vector3 based on the angle in parameters  More... | |
| static Vector3 | DirectionFromAngle2D (float angle, float additionalAngle) | 
| Returns a vector3 based on the angle in parameters  More... | |
Math helpers
      
  | 
  static | 
Computes and returns the angle between two vectors, on a 360° scale
| vectorA | Vector a. | 
| vectorB | Vector b. | 
      
  | 
  static | 
Computes and returns the direction between two vector3, used to check if a vector is pointing left or right of another one
| vectorA | Vector a. | 
| vectorB | Vector b. | 
      
  | 
  static | 
Moves from "from" to "to" by the specified amount and returns the corresponding value
| from | From. | 
| to | To. | 
| amount | Amount. | 
      
  | 
  static | 
Returns a random success based on X% of chance.
Example : I have 20% of chance to do X, Chance(20) > true, yay!
| percent | Percent of chance. | 
      
  | 
  static | 
Clamps a float between min and max, both bounds being optional and driven by clampMin and clampMax respectively
| value | |
| min | |
| max | |
| clampMin | |
| clampMax | 
      
  | 
  static | 
Clamps the angle in parameters between a minimum and maximum angle (all angles expressed in degrees)
| angle | |
| minimumAngle | |
| maximumAngle | 
      
  | 
  static | 
Returns a vector3 based on the angle in parameters
| angle | 
      
  | 
  static | 
Returns a vector3 based on the angle in parameters
| angle | 
      
  | 
  static | 
Returns the distance between a point and a line.
| point | Point. | 
| lineStart | Line start. | 
| lineEnd | Line end. | 
      
  | 
  static | 
Lerps a Color towards a target at the specified rate
| value | |
| target | |
| rate | 
      
  | 
  static | 
Lerps a Color32 towards a target at the specified rate
| value | |
| target | |
| rate | 
      
  | 
  static | 
Lerps a float towards a target at the specified rate
| value | |
| target | |
| rate | 
      
  | 
  static | 
Lerps a Quaternion towards a target at the specified rate
| value | |
| target | |
| rate | 
      
  | 
  static | 
Lerps a Vector2 towards a target at the specified rate
| value | |
| target | |
| rate | 
      
  | 
  static | 
Lerps a Vector3 towards a target at the specified rate
| value | |
| target | |
| rate | 
      
  | 
  static | 
Lerps a Vector4 towards a target at the specified rate
| value | |
| target | |
| rate | 
      
  | 
  static | 
| direction | 
      
  | 
  static | 
Projects a point on a line (perpendicularly) and returns the projected point.
| point | Point. | 
| lineStart | Line start. | 
| lineEnd | Line end. | 
      
  | 
  static | 
Returns a random point on the circle of the specified radius
| circleRadius | 
      
  | 
  static | 
Returns a random point on the sphere of the specified radius
| sphereRadius | 
      
  | 
  static | 
Returns a random Vector2 from 2 defined Vector2.
| min | Minimum. | 
| max | Maximum. | 
      
  | 
  static | 
Returns a random Vector3 from 2 defined Vector3.
| min | Minimum. | 
| max | Maximum. | 
      
  | 
  static | 
Remaps a value x in interval [A,B], to the proportional value in interval [C,D]
| x | The value to remap. | 
| A | the minimum bound of interval [A,B] that contains the x value | 
| B | the maximum bound of interval [A,B] that contains the x value | 
| C | the minimum bound of target interval [C,D] | 
| D | the maximum bound of target interval [C,D] | 
      
  | 
  static | 
Returns the result of rolling a dice of the specified number of sides
| numberOfSides | Number of sides of the dice. | 
      
  | 
  static | 
Rotates a point around the given pivot.
| point | The point to rotate. | 
| pivot | The pivot's position. | 
| angle | The angle we want to rotate our point. | 
      
  | 
  static | 
Rotates a point around the given pivot.
| point | The point to rotate. | 
| pivot | The pivot's position. | 
| angles | The angle as a Vector3. | 
      
  | 
  static | 
Rotates a point around the given pivot.
| point | The point to rotate. | 
| pivot | The pivot's position. | 
| angles | The angle as a Vector3. | 
      
  | 
  static | 
Rotates a vector2 by the angle (in degrees) specified and returns it
| vector | The vector to rotate. | 
| angle | Degrees. | 
      
  | 
  static | 
Rounds the value passed in parameters to the closest value in the parameter array
| value | |
| possibleValues | 
      
  | 
  static | 
      
  | 
  static | 
Rounds a float to the nearest half value : 1, 1.5, 2, 2.5 etc
| a | 
      
  | 
  static | 
Rounds all components of a Vector3.
| vector | Vector. | 
      
  | 
  static | 
Springs a float towards a target value
| currentValue | the current value to spring, passed as a ref | 
| targetValue | the target value we're aiming for | 
| velocity | a velocity value, passed as ref, used to compute the current speed of the springed value | 
| damping | the damping, between 0.01f and 1f, the higher the daming, the less springy it'll be | 
| frequency | the frequency, in Hz, so the amount of periods the spring should go over in 1 second | 
| speed | the speed (between 0 and 1) at which the spring should operate | 
| deltaTime | the delta time (usually Time.deltaTime or Time.unscaledDeltaTime) | 
      
  | 
  static | 
Springs a Vector2 towards a target value
| currentValue | the current value to spring, passed as a ref | 
| targetValue | the target value we're aiming for | 
| velocity | a velocity value, passed as ref, used to compute the current speed of the springed value | 
| damping | the damping, between 0.01f and 1f, the higher the daming, the less springy it'll be | 
| frequency | the frequency, in Hz, so the amount of periods the spring should go over in 1 second | 
| speed | the speed (between 0 and 1) at which the spring should operate | 
| deltaTime | the delta time (usually Time.deltaTime or Time.unscaledDeltaTime) | 
      
  | 
  static | 
Springs a Vector3 towards a target value
| currentValue | the current value to spring, passed as a ref | 
| targetValue | the target value we're aiming for | 
| velocity | a velocity value, passed as ref, used to compute the current speed of the springed value | 
| damping | the damping, between 0.01f and 1f, the higher the daming, the less springy it'll be | 
| frequency | the frequency, in Hz, so the amount of periods the spring should go over in 1 second | 
| speed | the speed (between 0 and 1) at which the spring should operate | 
| deltaTime | the delta time (usually Time.deltaTime or Time.unscaledDeltaTime) | 
      
  | 
  static | 
Springs a Vector4 towards a target value
| currentValue | the current value to spring, passed as a ref | 
| targetValue | the target value we're aiming for | 
| velocity | a velocity value, passed as ref, used to compute the current speed of the springed value | 
| damping | the damping, between 0.01f and 1f, the higher the daming, the less springy it'll be | 
| frequency | the frequency, in Hz, so the amount of periods the spring should go over in 1 second | 
| speed | the speed (between 0 and 1) at which the spring should operate | 
| deltaTime | the delta time (usually Time.deltaTime or Time.unscaledDeltaTime) | 
      
  | 
  static | 
Returns the sum of all the int passed in parameters
| thingsToAdd | Things to add. | 
      
  | 
  static | 
Takes a Vector2 and turns it into a Vector3 with a null z value
| target | The Vector2 to turn into a Vector3. | 
      
  | 
  static | 
Takes a Vector2 and turns it into a Vector3 with the specified z value
| target | The Vector2 to turn into a Vector3. | 
| newZValue | New Z value. | 
      
  | 
  static | 
Takes a Vector3 and turns it into a Vector2
| target | The Vector3 to turn into a Vector2. |