Physics2D: Fix shape BB
This commit is contained in:
@@ -41,7 +41,7 @@ namespace Nz
|
|||||||
|
|
||||||
float BoxCollider2D::ComputeInertialMatrix(float mass) const
|
float BoxCollider2D::ComputeInertialMatrix(float mass) const
|
||||||
{
|
{
|
||||||
return static_cast<float>(cpMomentForBox2(mass, cpBBNew(m_rect.x, m_rect.y + m_rect.height, m_rect.x + m_rect.width, m_rect.y)));
|
return static_cast<float>(cpMomentForBox2(mass, cpBBNew(m_rect.x, m_rect.y, m_rect.x + m_rect.width, m_rect.y + m_rect.height)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ColliderType2D BoxCollider2D::GetType() const
|
ColliderType2D BoxCollider2D::GetType() const
|
||||||
@@ -52,7 +52,7 @@ namespace Nz
|
|||||||
std::vector<cpShape*> BoxCollider2D::CreateShapes(RigidBody2D* body) const
|
std::vector<cpShape*> BoxCollider2D::CreateShapes(RigidBody2D* body) const
|
||||||
{
|
{
|
||||||
std::vector<cpShape*> shapes;
|
std::vector<cpShape*> shapes;
|
||||||
shapes.push_back(cpBoxShapeNew2(body->GetHandle(), cpBBNew(m_rect.x, m_rect.y + m_rect.height, m_rect.x + m_rect.width, m_rect.y), m_radius));
|
shapes.push_back(cpBoxShapeNew2(body->GetHandle(), cpBBNew(m_rect.x, m_rect.y, m_rect.x + m_rect.width, m_rect.y + m_rect.height), m_radius));
|
||||||
|
|
||||||
return shapes;
|
return shapes;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ namespace Nz
|
|||||||
};
|
};
|
||||||
|
|
||||||
cpShapeFilter filter = cpShapeFilterNew(collisionGroup, categoryMask, collisionMask);
|
cpShapeFilter filter = cpShapeFilterNew(collisionGroup, categoryMask, collisionMask);
|
||||||
cpSpaceBBQuery(m_handle, cpBBNew(boundingBox.x, boundingBox.y + boundingBox.height, boundingBox.x + boundingBox.width, boundingBox.y), filter, callback, bodies);
|
cpSpaceBBQuery(m_handle, cpBBNew(boundingBox.x, boundingBox.y, boundingBox.x + boundingBox.width, boundingBox.y + boundingBox.height), filter, callback, bodies);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysWorld2D::RegisterCallbacks(unsigned int collisionId, const Callback& callbacks)
|
void PhysWorld2D::RegisterCallbacks(unsigned int collisionId, const Callback& callbacks)
|
||||||
|
|||||||
Reference in New Issue
Block a user