mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 20:49:43 +00:00
Fixed division by zero
This commit is contained in:
parent
abf52079fc
commit
263824fa01
1 changed files with 1 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue