Class MathHelpers
- Namespace
- BSGameLib.Game
- Assembly
- BSGameLib.Game.dll
Helpers for moving values towards a target, easing curves, and angles.
public static class MathHelpers
- Inheritance
-
MathHelpers
- Inherited Members
Methods
Approach(Vector2, Vector2, float)
Moves value in a straight line towards target by at most delta. Returns target when it is within delta of it.
public static Vector2 Approach(Vector2 value, Vector2 target, float delta)
Parameters
Returns
Approach(float, float, float)
Moves value towards target by at most delta, and never past it.
public static float Approach(float value, float target, float delta)
Parameters
Returns
CubeIn(float)
The cubic ease-in curve, slow at the start, for t from 0 to 1.
public static float CubeIn(float t)
Parameters
tfloat
Returns
CubeInOut(float)
The cubic ease-in-out curve, slow at both ends, for t from 0 to 1.
public static float CubeInOut(float t)
Parameters
tfloat
Returns
CubeOut(float)
The cubic ease-out curve, slow at the end, for t from 0 to 1.
public static float CubeOut(float t)
Parameters
tfloat
Returns
Normal(Vector2)
Returns value scaled to a length of 1. Returns zero when value has no length.
public static Vector2 Normal(this Vector2 value)
Parameters
valueVector2
Returns
SmoothStep(float, float, float)
Returns the smooth step from 0 to 1 at t between min and max, clamped to 0 and 1 outside that range. The result is not defined when min equals max.
public static float SmoothStep(float min, float max, float t)
Parameters
Returns
ToRadians(int)
Converts degrees to radians.
public static float ToRadians(int degrees)
Parameters
degreesint