summaryrefslogtreecommitdiffstats
path: root/source/Entities/Entity.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-09-05 22:41:47 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-09-05 22:41:47 +0200
commit178b5884fc8cb4d58ed89868da55e1d241d8d1a9 (patch)
treeb4046d60ab36e105c07c276fffc4b2b1734cac69 /source/Entities/Entity.cpp
parentPickups spawn with correct speed and position (diff)
downloadcuberite-178b5884fc8cb4d58ed89868da55e1d241d8d1a9.tar
cuberite-178b5884fc8cb4d58ed89868da55e1d241d8d1a9.tar.gz
cuberite-178b5884fc8cb4d58ed89868da55e1d241d8d1a9.tar.bz2
cuberite-178b5884fc8cb4d58ed89868da55e1d241d8d1a9.tar.lz
cuberite-178b5884fc8cb4d58ed89868da55e1d241d8d1a9.tar.xz
cuberite-178b5884fc8cb4d58ed89868da55e1d241d8d1a9.tar.zst
cuberite-178b5884fc8cb4d58ed89868da55e1d241d8d1a9.zip
Diffstat (limited to 'source/Entities/Entity.cpp')
-rw-r--r--source/Entities/Entity.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/source/Entities/Entity.cpp b/source/Entities/Entity.cpp
index 8388bf092..a74f80058 100644
--- a/source/Entities/Entity.cpp
+++ b/source/Entities/Entity.cpp
@@ -519,17 +519,16 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
{
// Push out entity.
- if (NextChunk->GetBlock( RelBlockX + 1, BlockY, RelBlockZ ) == E_BLOCK_AIR) { NextPos.x += 0.2; }
- else if (NextChunk->GetBlock( RelBlockX - 1, BlockY, RelBlockZ ) == E_BLOCK_AIR) { NextPos.x += -0.2; }
- else if (NextChunk->GetBlock( RelBlockX, BlockY, RelBlockZ + 1 ) == E_BLOCK_AIR) { NextPos.z += 0.2; }
- else if (NextChunk->GetBlock( RelBlockX, BlockY, RelBlockZ - 1 ) == E_BLOCK_AIR) { NextPos.z += -0.2; }
- else { NextPos.y += 0.2; }
-
+ if (NextChunk->GetBlock( RelBlockX + 1, BlockY, RelBlockZ ) == E_BLOCK_AIR) { NextPos.x += 0.2; NextPos.z, NextPos.y = 0; }
+ else if (NextChunk->GetBlock( RelBlockX - 1, BlockY, RelBlockZ ) == E_BLOCK_AIR) { NextPos.x += -0.2; NextPos.z, NextPos.y = 0; }
+ else if (NextChunk->GetBlock( RelBlockX, BlockY, RelBlockZ + 1 ) == E_BLOCK_AIR) { NextPos.z += 0.2; NextPos.x, NextPos.y = 0; }
+ else if (NextChunk->GetBlock( RelBlockX, BlockY, RelBlockZ - 1 ) == E_BLOCK_AIR) { NextPos.z += -0.2; NextPos.x, NextPos.y = 0; }
+ else { NextPos.y += 0.2; NextPos.z, NextPos.x = 0;}
+
m_bOnGround = true;
- NextPos.y += 0.2;
- LOGD("Entity #%d (%s) is inside a block at {%d, %d, %d}",
- m_UniqueID, GetClass(), BlockX, BlockY, BlockZ
- );
+
+ LOGD("Entity #%d (%s) is inside a block at {%d,%d,%d}",
+ m_UniqueID, GetClass(), BlockX, BlockY, BlockZ);
}
if (!m_bOnGround)
@@ -647,8 +646,9 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
}
}
NextPos.Set(Tracer.RealHit.x,Tracer.RealHit.y,Tracer.RealHit.z);
- NextPos.x += Tracer.HitNormal.x * 0.5f;
- NextPos.z += Tracer.HitNormal.z * 0.5f;
+ NextPos.x += Tracer.HitNormal.x * 0.3f;
+ NextPos.y += Tracer.HitNormal.y * 0.1f; // Any larger produces entity vibration-upon-the-spot
+ NextPos.z += Tracer.HitNormal.z * 0.3f;
}
else
NextPos += (NextSpeed * a_Dt);