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)
This commit is contained in:
parent
f7359d9699
commit
50110b0cd6
2 changed files with 2 additions and 3 deletions
|
@ -55,13 +55,12 @@ void RigidBody::setMass(int handle, float mass)
|
||||||
|
|
||||||
void RigidBody::setMass(int handle, float mass, const float* pos, bool isStatic)
|
void RigidBody::setMass(int handle, float mass, const float* pos, bool isStatic)
|
||||||
{
|
{
|
||||||
_masses[handle].m = mass;
|
|
||||||
_masses[handle].isStatic = isStatic;
|
_masses[handle].isStatic = isStatic;
|
||||||
Math::set3(pos, _masses[handle].p);
|
Math::set3(pos, _masses[handle].p);
|
||||||
|
setMass(handle, mass);
|
||||||
if (_bodyN != 0) {
|
if (_bodyN != 0) {
|
||||||
SGPropertyNode_ptr n = _bodyN->getChild("mass", handle, true);
|
SGPropertyNode_ptr n = _bodyN->getChild("mass", handle, true);
|
||||||
n->getNode("isStatic", true)->setValue(isStatic);
|
n->getNode("isStatic", true)->setValue(isStatic);
|
||||||
n->getNode("mass", true)->setFloatValue(mass);
|
|
||||||
n->getNode("pos-x", true)->setFloatValue(pos[0]);
|
n->getNode("pos-x", true)->setFloatValue(pos[0]);
|
||||||
n->getNode("pos-y", true)->setFloatValue(pos[1]);
|
n->getNode("pos-y", true)->setFloatValue(pos[1]);
|
||||||
n->getNode("pos-z", true)->setFloatValue(pos[2]);
|
n->getNode("pos-z", true)->setFloatValue(pos[2]);
|
||||||
|
|
|
@ -82,7 +82,7 @@ public:
|
||||||
void setBodySpin(const float* rotation) { Math::set3(rotation, _spin); }
|
void setBodySpin(const float* rotation) { Math::set3(rotation, _spin); }
|
||||||
|
|
||||||
// Returns the center of gravity of the masses, in the body
|
// 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); }
|
void getCG(float* cgOut) { Math::set3(_cg, cgOut); }
|
||||||
|
|
||||||
// Returns the acceleration of the body's c.g. relative to the
|
// Returns the acceleration of the body's c.g. relative to the
|
||||||
|
|
Loading…
Reference in a new issue