diff options
Diffstat (limited to 'light-client/src/helper.rs')
-rw-r--r-- | light-client/src/helper.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/light-client/src/helper.rs b/light-client/src/helper.rs new file mode 100644 index 00000000..9654f519 --- /dev/null +++ b/light-client/src/helper.rs @@ -0,0 +1,11 @@ +use hurrycurry_protocol::glam::Vec2; + +pub trait Vec2InterpolateExt { + fn exp_to(&mut self, target: Vec2, dt: f32); +} +impl Vec2InterpolateExt for Vec2 { + fn exp_to(&mut self, target: Vec2, dt: f32) { + self.x = target.x + (self.x - target.x) * (-dt).exp(); + self.y = target.y + (self.y - target.y) * (-dt).exp(); + } +} |