summaryrefslogtreecommitdiff
path: root/src/vector.h
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-10-04 11:32:15 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-10-08 21:03:44 +0200
commit573df67919ec5f65a6b2ad51ed8aed31c9cfe4a6 (patch)
treee50500d452fdb3a503d3257477facc38017f7e10 /src/vector.h
parent7de0b165f196cb0c1f983b6d2ab26ef9791a2d36 (diff)
downloadmana-573df67919ec5f65a6b2ad51ed8aed31c9cfe4a6.tar.gz
mana-573df67919ec5f65a6b2ad51ed8aed31c9cfe4a6.tar.bz2
mana-573df67919ec5f65a6b2ad51ed8aed31c9cfe4a6.tar.xz
mana-573df67919ec5f65a6b2ad51ed8aed31c9cfe4a6.zip
Smoother being movement
There was a slight stutter in being movement, since each time a being reached the next position along its path, it would only continue to the following position with the next logic tick. Now the logic has been adjusted to keep moving until all the time for the current frame was used up, or the path was exhausted. A slight stutter remains for keyboard movement, as well as broken walk animation playback, since it will only set a new path once the current one is finished (see e554d9b2be1ec2fcb15065ae70151302adeef602). Also simplified some logic in Viewport::draw and removed some obsolete code in LocalPlayer::startWalking.
Diffstat (limited to 'src/vector.h')
-rw-r--r--src/vector.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vector.h b/src/vector.h
index 5d7d63d7..6bf6d81a 100644
--- a/src/vector.h
+++ b/src/vector.h
@@ -140,7 +140,7 @@ class Vector
*/
float length() const
{
- return sqrtf(x * x + y * y + z * z);
+ return std::sqrt(x * x + y * y + z * z);
}
/**
@@ -156,7 +156,7 @@ class Vector
*/
float manhattanLength() const
{
- return fabsf(x) + fabsf(y) + fabsf(z);
+ return std::abs(x) + std::abs(y) + std::abs(z);
}
/**