Upgrade Physics2D and Physics3D

This commit is contained in:
Jérôme Leclercq
2021-05-24 19:12:21 +02:00
parent 4bcb63d776
commit 8b0b5295f7
25 changed files with 239 additions and 448 deletions

View File

@@ -25,20 +25,20 @@ namespace Ndk
friend class PhysicsSystem2D;
public:
CollisionComponent2D(Nz::Collider2DRef geom = Nz::Collider2DRef());
CollisionComponent2D(std::shared_ptr<Nz::Collider2D> geom = std::shared_ptr<Nz::Collider2D>());
CollisionComponent2D(const CollisionComponent2D& collision);
~CollisionComponent2D() = default;
Nz::Rectf GetAABB() const;
const Nz::Collider2DRef& GetGeom() const;
const std::shared_ptr<Nz::Collider2D>& GetGeom() const;
const Nz::Vector2f& GetGeomOffset() const;
void Recenter(const Nz::Vector2f& origin);
void SetGeom(Nz::Collider2DRef geom, bool recomputeMoment = true, bool recomputeMassCenter = true);
void SetGeom(std::shared_ptr<Nz::Collider2D> geom, bool recomputeMoment = true, bool recomputeMassCenter = true);
void SetGeomOffset(const Nz::Vector2f& geomOffset);
CollisionComponent2D& operator=(Nz::Collider2DRef geom);
CollisionComponent2D& operator=(std::shared_ptr<Nz::Collider2D> geom);
CollisionComponent2D& operator=(CollisionComponent2D&& collision) = delete;
static ComponentIndex componentIndex;
@@ -56,7 +56,7 @@ namespace Ndk
void OnDetached() override;
std::unique_ptr<Nz::RigidBody2D> m_staticBody;
Nz::Collider2DRef m_geom;
std::shared_ptr<Nz::Collider2D> m_geom;
bool m_bodyUpdated;
};
}