A game where you get to play as a slime, made with Godot.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

12 lines
577 B

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));
}