From 9674d7373c205373c14a05738f3c9de96ec9a196 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sat, 20 Oct 2018 23:52:32 +0200 Subject: [PATCH] SDK/PhysicsComponent2D: Add missing parameter to SetMass --- ChangeLog.md | 1 + SDK/include/NDK/Components/PhysicsComponent2D.hpp | 2 +- SDK/include/NDK/Components/PhysicsComponent2D.inl | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 43f8aa898..e0091913d 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -221,6 +221,7 @@ Nazara Development Kit: - PhysicsComponent2D now allows massless bodies (zero mass) - ⚠️ Use of the new Angle class instead of floating point angle - Added EntityOwner::Release +- Add missing `recomputeMoment` parameter to PhysicsComponent2D::SetMass # 0.4: diff --git a/SDK/include/NDK/Components/PhysicsComponent2D.hpp b/SDK/include/NDK/Components/PhysicsComponent2D.hpp index 841b2df34..7d040c5a7 100644 --- a/SDK/include/NDK/Components/PhysicsComponent2D.hpp +++ b/SDK/include/NDK/Components/PhysicsComponent2D.hpp @@ -60,7 +60,7 @@ namespace Ndk inline void SetElasticity(std::size_t shapeIndex, float friction); inline void SetFriction(float friction); inline void SetFriction(std::size_t shapeIndex, float friction); - inline void SetMass(float mass); + inline void SetMass(float mass, bool recomputeMoment = true); inline void SetMassCenter(const Nz::Vector2f& center, Nz::CoordSys coordSys = Nz::CoordSys_Local); inline void SetMomentOfInertia(float moment); inline void SetPosition(const Nz::Vector2f& position); diff --git a/SDK/include/NDK/Components/PhysicsComponent2D.inl b/SDK/include/NDK/Components/PhysicsComponent2D.inl index 35782dcd9..387e50469 100644 --- a/SDK/include/NDK/Components/PhysicsComponent2D.inl +++ b/SDK/include/NDK/Components/PhysicsComponent2D.inl @@ -429,15 +429,16 @@ namespace Ndk * \brief Sets the mass of the physics object * * \param mass Mass of the object + * \param recomputeMoment Should the moment of inertia be recomputed according to the new mass * * \remark Mass must be positive or zero */ - inline void PhysicsComponent2D::SetMass(float mass) + inline void PhysicsComponent2D::SetMass(float mass, bool recomputeMoment) { NazaraAssert(m_object, "Invalid physics object"); NazaraAssert(mass >= 0.f, "Mass should be positive"); - m_object->SetMass(mass); + m_object->SetMass(mass, recomputeMoment); } /*!