diff options
author | metamuffin <metamuffin@disroot.org> | 2024-07-26 18:27:18 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-07-26 18:27:22 +0200 |
commit | 9c7673253f7dcc50d761345c3fdcd0d6d3654f3e (patch) | |
tree | 4a2c8c036f16e97c22767303a20d5be34635ef70 /server/src/lib.rs | |
parent | eb6527dec240c94d8cd27573c96c83cea2618cb3 (diff) | |
download | hurrycurry-9c7673253f7dcc50d761345c3fdcd0d6d3654f3e.tar hurrycurry-9c7673253f7dcc50d761345c3fdcd0d6d3654f3e.tar.bz2 hurrycurry-9c7673253f7dcc50d761345c3fdcd0d6d3654f3e.tar.zst |
add draft weather/environment system
Diffstat (limited to 'server/src/lib.rs')
-rw-r--r-- | server/src/lib.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/server/src/lib.rs b/server/src/lib.rs index a59aad11..2cbcc10b 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -20,5 +20,22 @@ pub mod data; pub mod entity; pub mod game; pub mod interaction; -pub mod state; pub mod spatial_index; +pub mod state; + +use hurrycurry_protocol::glam::Vec2; + +pub trait InterpolateExt { + fn exp_to(&mut self, target: Self, dt: f32); +} +impl InterpolateExt for Vec2 { + fn exp_to(&mut self, target: Self, dt: f32) { + self.x = target.x + (self.x - target.x) * (-dt).exp(); + self.y = target.y + (self.y - target.y) * (-dt).exp(); + } +} +impl InterpolateExt for f32 { + fn exp_to(&mut self, target: Self, dt: f32) { + *self = target + (*self - target) * (-dt).exp(); + } +} |