From 50110b0cd6f9aebb34e1e9c7077a3ab7e6837430 Mon Sep 17 00:00:00 2001 From: Henning Stahlke Date: Tue, 21 Mar 2017 22:47:07 +0100 Subject: [PATCH] YASIM: minor change to allow RigidBody addMass and setMass to trigger aggregation correctly. (not a problem up to now, just to be safe in future) --- src/FDM/YASim/RigidBody.cpp | 3 +-- src/FDM/YASim/RigidBody.hpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/FDM/YASim/RigidBody.cpp b/src/FDM/YASim/RigidBody.cpp index e1fb94b70..495098525 100644 --- a/src/FDM/YASim/RigidBody.cpp +++ b/src/FDM/YASim/RigidBody.cpp @@ -55,13 +55,12 @@ void RigidBody::setMass(int handle, float mass) void RigidBody::setMass(int handle, float mass, const float* pos, bool isStatic) { - _masses[handle].m = mass; _masses[handle].isStatic = isStatic; Math::set3(pos, _masses[handle].p); + setMass(handle, mass); if (_bodyN != 0) { SGPropertyNode_ptr n = _bodyN->getChild("mass", handle, true); n->getNode("isStatic", true)->setValue(isStatic); - n->getNode("mass", true)->setFloatValue(mass); n->getNode("pos-x", true)->setFloatValue(pos[0]); n->getNode("pos-y", true)->setFloatValue(pos[1]); n->getNode("pos-z", true)->setFloatValue(pos[2]); diff --git a/src/FDM/YASim/RigidBody.hpp b/src/FDM/YASim/RigidBody.hpp index d7ca39939..4b982e070 100644 --- a/src/FDM/YASim/RigidBody.hpp +++ b/src/FDM/YASim/RigidBody.hpp @@ -82,7 +82,7 @@ public: void setBodySpin(const float* rotation) { Math::set3(rotation, _spin); } // Returns the center of gravity of the masses, in the body - // coordinate system. + // coordinate system. valid only after recalc() void getCG(float* cgOut) { Math::set3(_cg, cgOut); } // Returns the acceleration of the body's c.g. relative to the