From a08daec53e0ee39104f419bb490b5dc8389ee4f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Sat, 5 Sep 2020 14:21:55 +0200 Subject: [PATCH] SDK/PhysicsComponent2D: Don't override moment and mass center when setting geom --- SDK/include/NDK/Components/CollisionComponent2D.hpp | 2 +- SDK/src/NDK/Components/CollisionComponent2D.cpp | 4 ++-- SDK/src/NDK/Components/PhysicsComponent2D.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SDK/include/NDK/Components/CollisionComponent2D.hpp b/SDK/include/NDK/Components/CollisionComponent2D.hpp index a5da3b8c2..9e7356b63 100644 --- a/SDK/include/NDK/Components/CollisionComponent2D.hpp +++ b/SDK/include/NDK/Components/CollisionComponent2D.hpp @@ -35,7 +35,7 @@ namespace Ndk void Recenter(const Nz::Vector2f& origin); - void SetGeom(Nz::Collider2DRef geom); + void SetGeom(Nz::Collider2DRef geom, bool recomputeMoment = true, bool recomputeMassCenter = true); void SetGeomOffset(const Nz::Vector2f& geomOffset); CollisionComponent2D& operator=(Nz::Collider2DRef geom); diff --git a/SDK/src/NDK/Components/CollisionComponent2D.cpp b/SDK/src/NDK/Components/CollisionComponent2D.cpp index fddbe8842..ed62b56ed 100644 --- a/SDK/src/NDK/Components/CollisionComponent2D.cpp +++ b/SDK/src/NDK/Components/CollisionComponent2D.cpp @@ -53,11 +53,11 @@ namespace Ndk * * \param geom Geometry used for collisions */ - void CollisionComponent2D::SetGeom(Nz::Collider2DRef geom) + void CollisionComponent2D::SetGeom(Nz::Collider2DRef geom, bool recomputeMoment, bool recomputeMassCenter) { m_geom = std::move(geom); - GetRigidBody()->SetGeom(m_geom); + GetRigidBody()->SetGeom(m_geom, recomputeMoment, recomputeMassCenter); } /*! diff --git a/SDK/src/NDK/Components/PhysicsComponent2D.cpp b/SDK/src/NDK/Components/PhysicsComponent2D.cpp index e5b42e183..ccc692db4 100644 --- a/SDK/src/NDK/Components/PhysicsComponent2D.cpp +++ b/SDK/src/NDK/Components/PhysicsComponent2D.cpp @@ -77,7 +77,7 @@ namespace Ndk if (IsComponent(component)) { NazaraAssert(m_object, "Invalid object"); - m_object->SetGeom(static_cast(component).GetGeom()); + m_object->SetGeom(static_cast(component).GetGeom(), false, false); } } @@ -94,7 +94,7 @@ namespace Ndk if (IsComponent(component)) { NazaraAssert(m_object, "Invalid object"); - m_object->SetGeom(Nz::NullCollider2D::New()); + m_object->SetGeom(Nz::NullCollider2D::New(), false, false); } }