YASim: clean up export of aero force and ground effect force to prop tree.
This commit is contained in:
parent
4259b548b0
commit
dbfe9a7b41
2 changed files with 17 additions and 20 deletions
|
@ -73,13 +73,14 @@ Model::Model()
|
||||||
_global_ground[0] = 0; _global_ground[1] = 0; _global_ground[2] = 1;
|
_global_ground[0] = 0; _global_ground[1] = 0; _global_ground[2] = 1;
|
||||||
_global_ground[3] = -100000;
|
_global_ground[3] = -100000;
|
||||||
_modelN = fgGetNode("/fdm/yasim/forces", true);
|
_modelN = fgGetNode("/fdm/yasim/forces", true);
|
||||||
_f0xN = _modelN->getNode("f0-aero-x-drag", true);
|
_fAeroXN = _modelN->getNode("f-x-drag", true);
|
||||||
_f0yN = _modelN->getNode("f0-aero-y-side", true);
|
_fAeroYN = _modelN->getNode("f-y-side", true);
|
||||||
_f0zN = _modelN->getNode("f0-aero-z-lift", true);
|
_fAeroZN = _modelN->getNode("f-z-lift", true);
|
||||||
_gefxN = _modelN->getNode("gndeff-f-x", true);
|
|
||||||
_gefyN = _modelN->getNode("gndeff-f-y", true);
|
_gefxN = fgGetNode("/fdm/yasim/debug/ground-effect/ge-f-x", true);
|
||||||
_gefzN = _modelN->getNode("gndeff-f-z", true);
|
_gefyN = fgGetNode("/fdm/yasim/debug/ground-effect/ge-f-y", true);
|
||||||
_wgdistN = _modelN->getNode("wing-gnd-dist", true);
|
_gefzN = fgGetNode("/fdm/yasim/debug/ground-effect/ge-f-z", true);
|
||||||
|
_wgdistN = fgGetNode("/fdm/yasim/debug/ground-effect/wing-gnd-dist", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Model::~Model()
|
Model::~Model()
|
||||||
|
@ -334,11 +335,6 @@ void Model::calcForces(State* s)
|
||||||
_body.addForce(pos, force);
|
_body.addForce(pos, force);
|
||||||
_body.addTorque(torque);
|
_body.addTorque(torque);
|
||||||
}
|
}
|
||||||
if (_modelN != 0) {
|
|
||||||
_f0xN->setFloatValue(faero[0]);
|
|
||||||
_f0yN->setFloatValue(faero[1]);
|
|
||||||
_f0zN->setFloatValue(faero[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (j=0; j<_rotorgear.getRotors()->size();j++)
|
for (j=0; j<_rotorgear.getRotors()->size();j++)
|
||||||
{
|
{
|
||||||
|
@ -384,7 +380,7 @@ void Model::calcForces(State* s)
|
||||||
// distance between ground and wing ref. point
|
// distance between ground and wing ref. point
|
||||||
float dist = ground[3] - Math::dot3(ground, _geRefPoint);
|
float dist = ground[3] - Math::dot3(ground, _geRefPoint);
|
||||||
float fz = 0;
|
float fz = 0;
|
||||||
float geForce[3];
|
float geForce[3] = {0, 0, 0};
|
||||||
if(dist > 0 && dist < _wingSpan) {
|
if(dist > 0 && dist < _wingSpan) {
|
||||||
fz = Math::dot3(faero, ground);
|
fz = Math::dot3(faero, ground);
|
||||||
fz *= (_wingSpan - dist) / _wingSpan;
|
fz *= (_wingSpan - dist) / _wingSpan;
|
||||||
|
@ -397,12 +393,13 @@ void Model::calcForces(State* s)
|
||||||
_gefyN->setFloatValue(geForce[1]);
|
_gefyN->setFloatValue(geForce[1]);
|
||||||
_gefzN->setFloatValue(geForce[2]);
|
_gefzN->setFloatValue(geForce[2]);
|
||||||
_wgdistN->setFloatValue(dist);
|
_wgdistN->setFloatValue(dist);
|
||||||
//float ld0 = faero[2]/faero[0];
|
|
||||||
//float ld = (geForce[2]+faero[2])/(geForce[0]+faero[0]);
|
|
||||||
//n->getNode("gndeff-ld-ld0", true)->setFloatValue(ld/ld0);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (_modelN != 0) {
|
||||||
|
_fAeroXN->setFloatValue(faero[0]);
|
||||||
|
_fAeroYN->setFloatValue(faero[1]);
|
||||||
|
_fAeroZN->setFloatValue(faero[2]);
|
||||||
|
}
|
||||||
// Convert the velocity and rotation vectors to local coordinates
|
// Convert the velocity and rotation vectors to local coordinates
|
||||||
float lrot[3], lv[3];
|
float lrot[3], lv[3];
|
||||||
Math::vmul33(s->orient, s->rot, lrot);
|
Math::vmul33(s->orient, s->rot, lrot);
|
||||||
|
|
|
@ -115,9 +115,9 @@ private:
|
||||||
bool _crashed;
|
bool _crashed;
|
||||||
float _agl;
|
float _agl;
|
||||||
SGPropertyNode_ptr _modelN;
|
SGPropertyNode_ptr _modelN;
|
||||||
SGPropertyNode_ptr _f0xN;
|
SGPropertyNode_ptr _fAeroXN;
|
||||||
SGPropertyNode_ptr _f0yN;
|
SGPropertyNode_ptr _fAeroYN;
|
||||||
SGPropertyNode_ptr _f0zN;
|
SGPropertyNode_ptr _fAeroZN;
|
||||||
SGPropertyNode_ptr _gefxN;
|
SGPropertyNode_ptr _gefxN;
|
||||||
SGPropertyNode_ptr _gefyN;
|
SGPropertyNode_ptr _gefyN;
|
||||||
SGPropertyNode_ptr _gefzN;
|
SGPropertyNode_ptr _gefzN;
|
||||||
|
|
Loading…
Reference in a new issue