Added better push out of entities

master
Tiger Wang 2013-09-04 17:52:15 +01:00
parent 9c22cf1520
commit 3300cfe491
1 changed files with 8 additions and 1 deletions

View File

@ -517,7 +517,14 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
}
else
{
// Push out entity.
//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; }
m_bOnGround = true;
NextPos.y += 0.2;
LOGD("Entity #%d (%s) is inside a block at {%d, %d, %d}",