diff options
author | Mattes D <github@xoft.cz> | 2017-05-28 20:56:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-28 20:56:17 +0200 |
commit | 0551d78dffd5d377de382e34d9f6c77773c68202 (patch) | |
tree | 1e0629ff3b9d602c2c058b2bcf07fd8c93a30974 /src/Entities | |
parent | Minor cBrewingRecipes cleanup (#3731) (diff) | |
download | cuberite-0551d78dffd5d377de382e34d9f6c77773c68202.tar cuberite-0551d78dffd5d377de382e34d9f6c77773c68202.tar.gz cuberite-0551d78dffd5d377de382e34d9f6c77773c68202.tar.bz2 cuberite-0551d78dffd5d377de382e34d9f6c77773c68202.tar.lz cuberite-0551d78dffd5d377de382e34d9f6c77773c68202.tar.xz cuberite-0551d78dffd5d377de382e34d9f6c77773c68202.tar.zst cuberite-0551d78dffd5d377de382e34d9f6c77773c68202.zip |
Diffstat (limited to 'src/Entities')
-rw-r--r-- | src/Entities/Entity.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index dff7114d5..f776f881a 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -1122,12 +1122,14 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) Vector3d HitCoords; Vector3i HitBlockCoords; eBlockFace HitBlockFace; - if (cLineBlockTracer::FirstSolidHitTrace(*GetWorld(), NextPos, NextPos + NextSpeed, HitCoords, HitBlockCoords, HitBlockFace)) + Vector3d wantNextPos = NextPos + NextSpeed * DtSec.count(); + auto isHit = cLineBlockTracer::FirstSolidHitTrace(*GetWorld(), NextPos, wantNextPos, HitCoords, HitBlockCoords, HitBlockFace); + if (isHit) { // Set our position to where the block was hit, minus a bit: // TODO: The real entity's m_Width should be taken into account here NextPos = HitCoords - NextSpeed.NormalizeCopy() * 0.1; - if (HitBlockFace == BLOCK_FACE_YM) + if (HitBlockFace == BLOCK_FACE_YP) { // We hit the ground, adjust the position to the top of the block: m_bOnGround = true; @@ -1161,11 +1163,11 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) } } } - } - else - { - // We didn't hit anything, so move =] - NextPos += (NextSpeed * DtSec.count()); + else + { + // We didn't hit anything, so move: + NextPos += (NextSpeed * DtSec.count()); + } } SetPosition(NextPos); |