Physics2D/Collider2D: Implement CompoundCollider2D and ConvexCollider2D

This commit is contained in:
Jérôme Leclercq
2017-07-27 11:39:23 +02:00
parent b00487c88c
commit afdc018778
5 changed files with 143 additions and 32 deletions

View File

@@ -245,7 +245,7 @@ namespace Nz
cpSpaceAddShape(space, shape);
}
cpBodySetMoment(m_handle, m_geom->ComputeInertialMatrix(m_mass));
cpBodySetMoment(m_handle, m_geom->ComputeMomentOfInertia(m_mass));
}
void RigidBody2D::SetMass(float mass)
@@ -257,7 +257,7 @@ namespace Nz
m_world->RegisterPostStep(this, [mass](Nz::RigidBody2D* body)
{
cpBodySetMass(body->GetHandle(), mass);
cpBodySetMoment(body->GetHandle(), body->GetGeom()->ComputeInertialMatrix(mass));
cpBodySetMoment(body->GetHandle(), body->GetGeom()->ComputeMomentOfInertia(mass));
});
}
else
@@ -271,7 +271,7 @@ namespace Nz
{
cpBodySetType(body->GetHandle(), CP_BODY_TYPE_DYNAMIC);
cpBodySetMass(body->GetHandle(), mass);
cpBodySetMoment(body->GetHandle(), body->GetGeom()->ComputeInertialMatrix(mass));
cpBodySetMoment(body->GetHandle(), body->GetGeom()->ComputeMomentOfInertia(mass));
}
});
}