mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Fixed division by zero
This commit is contained in:
parent
abf52079fc
commit
263824fa01
@ -551,7 +551,7 @@ class Entity extends stdClass{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function calculateVelocity(){
|
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]);
|
$origin = new Vector3($this->last[0], $this->last[1], $this->last[2]);
|
||||||
$final = new Vector3($this->x, $this->y, $this->z);
|
$final = new Vector3($this->x, $this->y, $this->z);
|
||||||
$speedX = ($this->last[0] - $this->x) / $diffTime;
|
$speedX = ($this->last[0] - $this->x) / $diffTime;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user