1
0

Check for intersection between placed blocks and entities. (#3850)

* Check for intersection between placed blocks and entities.

+ Implemented GetPlacementCollisionBox, to permit custom placement collision boxes for blocks.

* Factored block-entity placement checking into another function in cPlayer.

- Removed vector min/max functions

* Use GetWorld to get the world in DoesPlacingBlocksIntersectEntity.

+ Added block height checks, allow different cEntity subclasses to decide whether they will prevent block placement.
This commit is contained in:
Lane Kolbly
2017-07-28 11:59:21 -05:00
committed by Tiger Wang
parent eb4432bb62
commit 5402b214b3
17 changed files with 300 additions and 3 deletions

View File

@@ -60,6 +60,17 @@ cBoundingBox::cBoundingBox(const cBoundingBox & a_Orig) :
cBoundingBox & cBoundingBox::operator=(const cBoundingBox & a_Other)
{
m_Min = a_Other.m_Min;
m_Max = a_Other.m_Max;
return *this;
}
void cBoundingBox::Move(double a_OffX, double a_OffY, double a_OffZ)
{
m_Min.x += a_OffX;
@@ -119,10 +130,10 @@ cBoundingBox cBoundingBox::Union(const cBoundingBox & a_Other)
{
return cBoundingBox(
std::min(m_Min.x, a_Other.m_Min.x),
std::min(m_Min.y, a_Other.m_Min.y),
std::min(m_Min.z, a_Other.m_Min.z),
std::max(m_Max.x, a_Other.m_Max.x),
std::min(m_Min.y, a_Other.m_Min.y),
std::max(m_Max.y, a_Other.m_Max.y),
std::min(m_Min.z, a_Other.m_Min.z),
std::max(m_Max.z, a_Other.m_Max.z)
);
}