Physics2D: Add DebugDraw method

This commit is contained in:
Jérôme Leclercq
2017-10-13 15:14:37 +02:00
parent b14a9f219a
commit 101783126c
4 changed files with 148 additions and 0 deletions

View File

@@ -184,6 +184,15 @@ namespace Nz
return FromRadians(static_cast<float>(cpBodyGetAngle(m_handle)));
}
std::size_t RigidBody2D::GetShapeIndex(cpShape* shape) const
{
auto it = std::find(m_shapes.begin(), m_shapes.end(), shape);
if (it == m_shapes.end())
return InvalidShapeIndex;
return std::distance(m_shapes.begin(), it);
}
void* RigidBody2D::GetUserdata() const
{
return m_userData;