Skip to content

Commit

Permalink
fix speed average
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Aug 7, 2024
1 parent 485a5e3 commit 5ce3b51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ public void updateLatestPosition(Location location) {
}

public void calcSpeedAvg(boolean using3D, long period) {
speedAvg = Math.abs(using3D ? LocationUtil.getRelDistance3D(previous, latest) : LocationUtil.getRelDistance2D(previous, latest)) / period;
// Blockdistance per tick
speedAvg = Math.abs(using3D ? LocationUtil.getRelDistance3D(previous, latest) : LocationUtil.getRelDistance2D(previous, latest)) / ((double) period / 50);
previous = latest.clone();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ public void updateLatestPosition(Location location) {
}

public void calcSpeedAvg(boolean using3D, long period) {
speedAvg = Math.abs(using3D ? LocationUtil.getRelDistance3D(previous, latest) : LocationUtil.getRelDistance2D(previous, latest)) / period;
// Blockdistance per tick
speedAvg = Math.abs(using3D ? LocationUtil.getRelDistance3D(previous, latest) : LocationUtil.getRelDistance2D(previous, latest)) / ((double) period / 50);
previous = latest.clone();
}
};
Expand Down

0 comments on commit 5ce3b51

Please sign in to comment.