parent
6decf97524
commit
00579c8559
6 changed files with 53 additions and 4 deletions
@ -0,0 +1,12 @@ |
||||
public static class MathExtensions |
||||
{ |
||||
// Framerate independent dampening functions, similar to lerp. |
||||
// https://rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/ |
||||
public static float Damp(this float from, float to, float lambda, double delta) |
||||
=> Lerp(from, to, 1 - Exp(-lambda * (float)delta)); |
||||
public static Vector3 Damp(this Vector3 from, Vector3 to, float lambda, double delta) |
||||
=> from.Lerp(to, 1 - Exp(-lambda * (float)delta)); |
||||
|
||||
public static Vector2I RoundToVector2I(this Vector2 vector) |
||||
=> new(RoundToInt(vector.X), RoundToInt(vector.Y)); |
||||
} |
Loading…
Reference in new issue