diff options
| author | iamcheeseman <[hidden email]> | 2026-01-16 14:02:01 -0500 |
|---|---|---|
| committer | iamcheeseman <[hidden email]> | 2026-01-16 14:02:01 -0500 |
| commit | 64e3dc9c109f4f76d5d1f65a9082340213985361 (patch) | |
| tree | 37c2652ea82e18b4bf65cb142c9b81d5ae53ec4a /src/math.odin | |
| parent | f5a8333aaf0104d3aba4f096c9180cd8287ac1ff (diff) | |
Add recoil to the gun
Diffstat (limited to 'src/math.odin')
| -rw-r--r-- | src/math.odin | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/math.odin b/src/math.odin new file mode 100644 index 0000000..0cd2a27 --- /dev/null +++ b/src/math.odin @@ -0,0 +1,21 @@ +package demonchime + +import "core:math" +import "core:math/linalg" + +import rl "vendor:raylib" + +dt_lerp :: proc { + dt_lerp_f32, + dt_lerp_arr, +} + +dt_lerp_f32 :: proc(a: f32, b: f32, t: f32) -> f32 { + dt := rl.GetFrameTime() + return math.lerp(b, a, math.pow(0.5, dt * t)) +} + +dt_lerp_arr :: proc(a: [$N]$T, b: [N]T, t: T) -> [N]T { + dt := rl.GetFrameTime() + return linalg.lerp(b, a, math.pow(0.5, dt * t)) +} |
