diff options
author | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
commit | 15740faf9fe9fe4be08965098bbf2947e096aeeb (patch) | |
tree | a730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Physics2D/PolygonCollider2D.h |
Diffstat (limited to 'Runtime/Physics2D/PolygonCollider2D.h')
-rw-r--r-- | Runtime/Physics2D/PolygonCollider2D.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Runtime/Physics2D/PolygonCollider2D.h b/Runtime/Physics2D/PolygonCollider2D.h new file mode 100644 index 0000000..6a5ed55 --- /dev/null +++ b/Runtime/Physics2D/PolygonCollider2D.h @@ -0,0 +1,36 @@ +#pragma once + +#if ENABLE_2D_PHYSICS || DOXYGEN + +#include "Runtime/Math/Vector2.h" +#include "Runtime/Utilities/dynamic_array.h" +#include "Runtime/Physics2D/Collider2D.h" +#include "Runtime/Physics2D/PolygonColliderBase2D.h" + + +// -------------------------------------------------------------------------- + + +class PolygonCollider2D : public PolygonColliderBase2D +{ +public: + REGISTER_DERIVED_CLASS (PolygonCollider2D, PolygonColliderBase2D) + DECLARE_OBJECT_SERIALIZE (PolygonCollider2D) + + PolygonCollider2D (MemLabelId label, ObjectCreationMode mode); + + virtual void Reset (); + virtual void SmartReset (); + + virtual const Polygon2D& GetPoly() const { return m_Poly; } + Polygon2D& GetPoly() { return m_Poly; } + void RefreshPoly(); + + void CreatePrimitive (int sides, Vector2f scale = Vector2f(1.0f, 1.0f), Vector2f offset = Vector2f::zero); + static void CreateNgon (const int sides, const Vector2f scale, const Vector2f offset, Polygon2D& polygon2D); + +private: + Polygon2D m_Poly; +}; + +#endif |