From 263824fa0127dbcece6e5f647a926381bd4deaa3 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Sat, 30 Mar 2013 21:35:59 +0100 Subject: [PATCH] Fixed division by zero --- src/world/Entity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/world/Entity.php b/src/world/Entity.php index ca43d0618..8cf68c6a0 100644 --- a/src/world/Entity.php +++ b/src/world/Entity.php @@ -551,7 +551,7 @@ class Entity extends stdClass{ } public function calculateVelocity(){ - $diffTime = microtime(true) - $this->last[5]; + $diffTime = max(0.05, abs(microtime(true) - $this->last[5])); $origin = new Vector3($this->last[0], $this->last[1], $this->last[2]); $final = new Vector3($this->x, $this->y, $this->z); $speedX = ($this->last[0] - $this->x) / $diffTime;