Patch from Joacim to fix a bug where rotor weights were doubled.
This commit is contained in:
parent
23ab95802b
commit
5aa142ee5f
4 changed files with 11 additions and 19 deletions
|
@ -482,9 +482,9 @@ float Airplane::compileWing(Wing* w)
|
|||
return wgt;
|
||||
}
|
||||
|
||||
float Airplane::compileRotorgear()
|
||||
void Airplane::compileRotorgear()
|
||||
{
|
||||
return getRotorgear()->compile(_model.getBody());
|
||||
getRotorgear()->compile();
|
||||
}
|
||||
|
||||
float Airplane::compileFuselage(Fuselage* f)
|
||||
|
@ -626,8 +626,6 @@ void Airplane::compile()
|
|||
for(i=0; i<_vstabs.size(); i++)
|
||||
aeroWgt += compileWing((Wing*)_vstabs.get(i));
|
||||
|
||||
// The rotor(s)
|
||||
aeroWgt += compileRotorgear();
|
||||
|
||||
// The fuselage(s)
|
||||
for(i=0; i<_fuselages.size(); i++)
|
||||
|
@ -681,7 +679,12 @@ void Airplane::compile()
|
|||
|
||||
solveGear();
|
||||
if(_wing && _tail) solve();
|
||||
else solveHelicopter();
|
||||
else
|
||||
{
|
||||
// The rotor(s) mass:
|
||||
compileRotorgear();
|
||||
solveHelicopter();
|
||||
}
|
||||
|
||||
// Do this after solveGear, because it creates "gear" objects that
|
||||
// we don't want to affect.
|
||||
|
|
|
@ -108,7 +108,7 @@ private:
|
|||
void solve();
|
||||
void solveHelicopter();
|
||||
float compileWing(Wing* w);
|
||||
float compileRotorgear();
|
||||
void compileRotorgear();
|
||||
float compileFuselage(Fuselage* f);
|
||||
void compileGear(GearRec* gr);
|
||||
void applyDragFactor(float factor);
|
||||
|
|
|
@ -1362,24 +1362,13 @@ void Rotorgear::addRotor(Rotor* rotor)
|
|||
_in_use = 1;
|
||||
}
|
||||
|
||||
float Rotorgear::compile(RigidBody* body)
|
||||
void Rotorgear::compile()
|
||||
{
|
||||
float wgt = 0;
|
||||
for(int j=0; j<_rotors.size(); j++) {
|
||||
Rotor* r = (Rotor*)_rotors.get(j);
|
||||
r->compile();
|
||||
int i;
|
||||
for(i=0; i<r->numRotorparts(); i++) {
|
||||
Rotorpart* rp = (Rotorpart*)r->getRotorpart(i);
|
||||
float mass = rp->getWeight();
|
||||
mass = mass * Math::sqrt(mass);
|
||||
float pos[3];
|
||||
rp->getPosition(pos);
|
||||
body->addMass(mass, pos);
|
||||
wgt += mass;
|
||||
}
|
||||
}
|
||||
return wgt;
|
||||
}
|
||||
|
||||
void Rotorgear::getDownWash(float *pos, float * v_heli, float *downwash)
|
||||
|
|
|
@ -223,7 +223,7 @@ public:
|
|||
~Rotorgear();
|
||||
int isInUse() {return _in_use;}
|
||||
void setInUse() {_in_use = 1;}
|
||||
float compile(RigidBody* body);
|
||||
void compile();
|
||||
void addRotor(Rotor* rotor);
|
||||
int getNumRotors() {return _rotors.size();}
|
||||
Rotor* getRotor(int i) {return (Rotor*)_rotors.get(i);}
|
||||
|
|
Loading…
Reference in a new issue