aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/customer/movement.rs2
-rw-r--r--server/src/customer/pathfinding.rs6
-rw-r--r--test-client/movement.ts2
3 files changed, 7 insertions, 3 deletions
diff --git a/server/src/customer/movement.rs b/server/src/customer/movement.rs
index b45c7931..6a70a44f 100644
--- a/server/src/customer/movement.rs
+++ b/server/src/customer/movement.rs
@@ -13,7 +13,7 @@ pub struct MovementBase {
impl MovementBase {
pub fn update(&mut self, map: &HashSet<IVec2>, direction: Vec2, dt: f32) -> PacketS {
- let direction = direction.normalize_or_zero();
+ let direction = direction.clamp_length_max(1.);
if direction.length() > 0.1 {
self.facing = direction + (self.facing - direction) * (-dt * 10.).exp();
}
diff --git a/server/src/customer/pathfinding.rs b/server/src/customer/pathfinding.rs
index d25c6913..26de9c51 100644
--- a/server/src/customer/pathfinding.rs
+++ b/server/src/customer/pathfinding.rs
@@ -21,7 +21,11 @@ impl Path {
if next.distance(customer.position) < if self.0.len() == 1 { 0.1 } else { 0.6 } {
self.0.pop();
}
- customer.update(&walkable, next - customer.position, dt)
+ customer.update(
+ &walkable,
+ (next - customer.position).normalize_or_zero() * 0.5,
+ dt,
+ )
} else {
customer.update(&walkable, Vec2::ZERO, dt)
}
diff --git a/test-client/movement.ts b/test-client/movement.ts
index 883a64ec..88c47c33 100644
--- a/test-client/movement.ts
+++ b/test-client/movement.ts
@@ -42,7 +42,7 @@ function collide_player(p: PlayerData, dt: number) {
if (d < 0.01) continue
if (d >= PLAYER_SIZE * 2) continue
const norm = normalize(diff);
- const f = 1 / (1 + d)
+ const f = 100 / (1 + d)
p.vel.x += norm.x * f * dt
p.vel.y += norm.y * f * dt
}