1
0
Fork 0

Vivian Meazza:

As a result of recent requests, I've implemented the ability to switch off
aerodynamic stabilisation:

This has to be added to the submodel.xml files:

<aero-stabilised>false</aero-stabilised>

When false the submodel retains the pitch given at instantiation.

It defaults to true.
This commit is contained in:
ehofman 2004-10-28 08:29:15 +00:00
parent 2a94cedeba
commit e5b1ab4831
6 changed files with 11 additions and 6 deletions

View file

@ -44,7 +44,6 @@ FGAIBallistic::~FGAIBallistic() {
bool FGAIBallistic::init() { bool FGAIBallistic::init() {
FGAIBase::init(); FGAIBase::init();
aero_stabilized = true;
hdg = azimuth; hdg = azimuth;
pitch = elevation; pitch = elevation;
roll = rotation; roll = rotation;
@ -84,8 +83,8 @@ void FGAIBallistic::setRoll(double rl) {
rotation = rl; rotation = rl;
} }
void FGAIBallistic::setStabilization(bool val) { void FGAIBallistic::setStabilisation(bool val) {
aero_stabilized = val; aero_stabilised = val;
} }
void FGAIBallistic::setDragArea(double a) { void FGAIBallistic::setDragArea(double a) {
@ -181,7 +180,8 @@ void FGAIBallistic::Run(double dt) {
pos.setelev(altitude * SG_FEET_TO_METER); pos.setelev(altitude * SG_FEET_TO_METER);
// recalculate pitch (velocity vector) if aerostabilized // recalculate pitch (velocity vector) if aerostabilized
if (aero_stabilized) pitch = atan2( vs, hs ) * SG_RADIANS_TO_DEGREES; // cout << "aero_stabilised " << aero_stabilised << endl ;
if (aero_stabilised) pitch = atan2( vs, hs ) * SG_RADIANS_TO_DEGREES;
// recalculate total speed // recalculate total speed
speed = sqrt( vs * vs + hs * hs); speed = sqrt( vs * vs + hs * hs);

View file

@ -39,7 +39,7 @@ public:
void setAzimuth( double az ); void setAzimuth( double az );
void setElevation( double el ); void setElevation( double el );
void setRoll( double rl ); void setRoll( double rl );
void setStabilization( bool val ); void setStabilisation( bool val );
void setDragArea( double a ); void setDragArea( double a );
void setLife( double seconds ); void setLife( double seconds );
void setBuoyancy( double fpss ); void setBuoyancy( double fpss );
@ -57,7 +57,7 @@ private:
double elevation; // degrees double elevation; // degrees
double rotation; // degrees double rotation; // degrees
double hs; // horizontal speed (fps) double hs; // horizontal speed (fps)
bool aero_stabilized; // if true, object will point where it's going bool aero_stabilised; // if true, object will align wit trajectory
double drag_area; // equivalent drag area in ft2 double drag_area; // equivalent drag area in ft2
double life_timer; // seconds double life_timer; // seconds
double gravity; // fps2 double gravity; // fps2

View file

@ -65,6 +65,7 @@ typedef struct {
double cd; // coefficient of drag double cd; // coefficient of drag
bool wind; // if true, model reacts to parent wind bool wind; // if true, model reacts to parent wind
double mass; // in slugs double mass; // in slugs
bool aero_stabilised; // if true, ballistic object aligns with trajectory
} FGAIModelEntity; } FGAIModelEntity;

View file

@ -207,6 +207,7 @@ FGAIManager::createBallistic( FGAIModelEntity *entity ) {
ai_ballistic->setRoll(entity->roll); ai_ballistic->setRoll(entity->roll);
ai_ballistic->setCd(entity->cd); ai_ballistic->setCd(entity->cd);
ai_ballistic->setMass(entity->mass); ai_ballistic->setMass(entity->mass);
ai_ballistic->setStabilisation(entity->aero_stabilised);
ai_ballistic->init(); ai_ballistic->init();
ai_ballistic->bind(); ai_ballistic->bind();
return ai_ballistic; return ai_ballistic;

View file

@ -129,6 +129,7 @@ FGSubmodelMgr::release (submodel* sm, double dt)
entity.wind = sm->wind; entity.wind = sm->wind;
entity.cd = sm->cd; entity.cd = sm->cd;
entity.mass = IC.mass; entity.mass = IC.mass;
entity.aero_stabilised = sm->aero_stabilised;
ai->createBallistic( &entity ); ai->createBallistic( &entity );
if (sm->count > 0) (sm->count)--; if (sm->count > 0) (sm->count)--;
@ -184,6 +185,7 @@ FGSubmodelMgr::load ()
sm->first_time = false; sm->first_time = false;
sm->cd = entry_node->getDoubleValue("cd", 0.193); sm->cd = entry_node->getDoubleValue("cd", 0.193);
sm->weight = entry_node->getDoubleValue("weight", 0.25); sm->weight = entry_node->getDoubleValue("weight", 0.25);
sm->aero_stabilised = entry_node->getBoolValue ("aero-stabilised", true);
sm->contents_node = fgGetNode(entry_node->getStringValue("contents", "none"), true); sm->contents_node = fgGetNode(entry_node->getStringValue("contents", "none"), true);
sm->trigger->setBoolValue(false); sm->trigger->setBoolValue(false);

View file

@ -52,6 +52,7 @@ public:
double cd; double cd;
double weight; double weight;
double contents; double contents;
bool aero_stabilised;
} submodel; } submodel;
typedef struct { typedef struct {