From 7638b25cf618cfcce97c58ccdcaa8366a6bb8532 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 13 Jul 2020 17:54:52 +0100 Subject: Box size changes --- src/Entities/Entity.cpp | 14 +++++++------- src/Entities/Pickup.cpp | 2 +- src/Mobs/Sheep.cpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 00eeaf8e6..37ef925cf 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -1078,7 +1078,7 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { switch (a_EntryFace) { - case BLOCK_FACE_NONE: ASSERT(!"Bounding box intersected a block; the direction vector was too short and didn't clear the block"); + case BLOCK_FACE_NONE: return 0; case BLOCK_FACE_XM: return (a_Intersection.GetMaxX() - a_Block.GetMinX()) / a_Direction.x; case BLOCK_FACE_XP: return (a_Intersection.GetMinX() - a_Block.GetMaxX()) / a_Direction.x; case BLOCK_FACE_YM: return (a_Intersection.GetMaxY() - a_Block.GetMinY()) / a_Direction.y; @@ -1091,14 +1091,13 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) void TestBoundingBoxCollisionWithEnvironment(const Vector3d a_TraceIntersection) { cBoundingBox Entity(a_TraceIntersection, m_Entity.GetWidth() / 2, m_Entity.GetHeight()); - Entity.Expand(0.025, 0.001, 0.025); + Entity.Expand(0.0, 0.001, 0.0); + + ASSERT(m_End != m_Start); auto Direction = m_End - m_Start; auto Backoff = std::make_pair(0.0, BLOCK_FACE_NONE); - Direction.Normalize(); - Direction *= 10; - for (const auto & Test : GetBlocksToTestAround(Entity)) { cChunk * Chunk; @@ -1139,8 +1138,8 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) virtual bool OnNextBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, eBlockFace a_EntryFace) override { + // TODO: comment // We hit a solid block, calculate the exact hit coords and abort trace: - //m_HitBlockCoords = a_BlockPos; m_HitBlockFace = a_EntryFace; double LineCoeff = 0; // Used to calculate where along the line an intersection with the bounding box occurs @@ -1167,7 +1166,8 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) Vector3d & m_HitCoords; }; - while ((DtSec > 0.001) && (NextSpeed.SqrLength() > 0.0f)) + // TODO: comment + while ((DtSec > 0.001) && (NextSpeed.SqrLength() > 0.001)) { Vector3d HitCoords; eBlockFace HitBlockFace; diff --git a/src/Entities/Pickup.cpp b/src/Entities/Pickup.cpp index 4b05c2b9b..9b793725b 100644 --- a/src/Entities/Pickup.cpp +++ b/src/Entities/Pickup.cpp @@ -94,7 +94,7 @@ protected: // cPickup: cPickup::cPickup(Vector3d a_Pos, const cItem & a_Item, bool IsPlayerCreated, Vector3f a_Speed, int a_LifetimeTicks, bool a_CanCombine): - Super(etPickup, a_Pos, 0.2, 0.2), + Super(etPickup, a_Pos, 0.25, 0.25), m_Timer(0), m_Item(a_Item), m_bCollected(false), diff --git a/src/Mobs/Sheep.cpp b/src/Mobs/Sheep.cpp index 2a6d27969..a9916de79 100644 --- a/src/Mobs/Sheep.cpp +++ b/src/Mobs/Sheep.cpp @@ -12,7 +12,7 @@ cSheep::cSheep(int a_Color) : - Super("Sheep", mtSheep, "entity.sheep.hurt", "entity.sheep.death", "entity.sheep.ambient", 0.6, 1.3), + Super("Sheep", mtSheep, "entity.sheep.hurt", "entity.sheep.death", "entity.sheep.ambient", 0.9, 1.3), m_IsSheared(false), m_WoolColor(a_Color), m_TimeToStopEating(-1) -- cgit v1.2.3