Physics2D: Add NearestBodyQuery

This commit is contained in:
Jérôme Leclercq
2017-03-01 17:40:12 +01:00
parent f22dd81d35
commit 5ebf125474
6 changed files with 101 additions and 4 deletions

View File

@@ -13,9 +13,12 @@ namespace Nz
std::vector<cpShape*> Collider2D::GenerateShapes(RigidBody2D* body) const
{
cpShapeFilter filter = cpShapeFilterNew(m_collisionGroup, m_categoryMask, m_collisionMask);
std::vector<cpShape*> shapes = CreateShapes(body);
for (cpShape* shape : shapes)
{
cpShapeSetFilter(shape, filter);
cpShapeSetCollisionType(shape, m_collisionId);
cpShapeSetSensor(shape, (m_trigger) ? cpTrue : cpFalse);
}