Physics2D/RigidBody: Add position offset

This commit is contained in:
Lynix
2019-03-26 18:59:18 +01:00
parent ffc58e9806
commit 3beeeebc1d
6 changed files with 86 additions and 29 deletions

View File

@@ -28,10 +28,14 @@ namespace Ndk
CollisionComponent2D(const CollisionComponent2D& collision);
~CollisionComponent2D() = default;
void Align(const Nz::Rectf& aabb);
Nz::Rectf GetAABB() const;
const Nz::Collider2DRef& GetGeom() const;
const Nz::Vector2f& GetGeomOffset() const;
void SetGeom(Nz::Collider2DRef geom);
void SetGeomOffset(const Nz::Vector2f& geomOffset);
CollisionComponent2D& operator=(Nz::Collider2DRef geom);
CollisionComponent2D& operator=(CollisionComponent2D&& collision) = default;
@@ -40,6 +44,8 @@ namespace Ndk
private:
void InitializeStaticBody();
Nz::RigidBody2D* GetRigidBody();
const Nz::RigidBody2D* GetRigidBody() const;
Nz::RigidBody2D* GetStaticBody();
void OnAttached() override;

View File

@@ -28,16 +28,6 @@ namespace Ndk
{
}
/*!
* \brief Gets the collision box representing the entity
* \return The physics collision box
*/
inline Nz::Rectf CollisionComponent2D::GetAABB() const
{
return m_staticBody->GetAABB();
}
/*!
* \brief Gets the geometry representing the entity
* \return A constant reference to the physics geometry