Physics2D/Collider2D: Add support for neighbors vertices

This commit is contained in:
Lynix
2020-01-01 17:25:22 +01:00
parent f371cbb386
commit df2a029f30
4 changed files with 27 additions and 1 deletions

View File

@@ -191,8 +191,15 @@ namespace Nz
}
SegmentCollider2D::SegmentCollider2D(const Vector2f& first, const Vector2f& second, float thickness) :
SegmentCollider2D(first, first, second, second, thickness)
{
}
inline SegmentCollider2D::SegmentCollider2D(const Vector2f& first, const Vector2f& firstNeighbor, const Vector2f& second, const Vector2f& secondNeighbor, float thickness) :
m_first(first),
m_firstNeighbor(firstNeighbor),
m_second(second),
m_secondNeighbor(secondNeighbor),
m_thickness(thickness)
{
}
@@ -202,6 +209,11 @@ namespace Nz
return m_first;
}
inline const Vector2f& SegmentCollider2D::GetFirstPointNeighbor() const
{
return m_firstNeighbor;
}
inline float SegmentCollider2D::GetLength() const
{
return m_first.Distance(m_second);
@@ -212,6 +224,11 @@ namespace Nz
return m_second;
}
inline const Vector2f& SegmentCollider2D::GetSecondPointNeighbor() const
{
return m_secondNeighbor;
}
inline float SegmentCollider2D::GetThickness() const
{
return m_thickness;