aboutsummaryrefslogtreecommitdiff
path: root/light-client/src/helper.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-07-16 23:37:56 +0200
committermetamuffin <metamuffin@disroot.org>2024-07-16 23:37:56 +0200
commit3a358c6dd39aa78319549658adf1028cea61f643 (patch)
treef84f0a2a4c4c675c0fab77ad3aeadc81928fd17d /light-client/src/helper.rs
parent695b1130bdf5c13d7857d8ddb10ee24d10fcf325 (diff)
downloadhurrycurry-3a358c6dd39aa78319549658adf1028cea61f643.tar
hurrycurry-3a358c6dd39aa78319549658adf1028cea61f643.tar.bz2
hurrycurry-3a358c6dd39aa78319549658adf1028cea61f643.tar.zst
defenitely pixels now.
Diffstat (limited to 'light-client/src/helper.rs')
-rw-r--r--light-client/src/helper.rs11
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();
+ }
+}