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

@@ -230,13 +230,16 @@ namespace Nz
{
public:
inline SegmentCollider2D(const Vector2f& first, const Vector2f& second, float thickness = 1.f);
inline SegmentCollider2D(const Vector2f& first, const Vector2f& firstNeighbor, const Vector2f& second, const Vector2f& secondNeighbor, float thickness = 1.f);
Nz::Vector2f ComputeCenterOfMass() const override;
float ComputeMomentOfInertia(float mass) const override;
inline const Vector2f& GetFirstPoint() const;
inline const Vector2f& GetFirstPointNeighbor() const;
inline float GetLength() const;
inline const Vector2f& GetSecondPoint() const;
inline const Vector2f& GetSecondPointNeighbor() const;
inline float GetThickness() const;
ColliderType2D GetType() const override;
@@ -246,7 +249,9 @@ namespace Nz
std::size_t CreateShapes(RigidBody2D* body, std::vector<cpShape*>* shapes) const override;
Vector2f m_first;
Vector2f m_firstNeighbor;
Vector2f m_second;
Vector2f m_secondNeighbor;
float m_thickness;
};
}