parent
6decf97524
commit
a787b493cc
7 changed files with 74 additions and 26 deletions
File diff suppressed because one or more lines are too long
@ -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