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:
parent
2a94cedeba
commit
e5b1ab4831
6 changed files with 11 additions and 6 deletions
|
@ -44,7 +44,6 @@ FGAIBallistic::~FGAIBallistic() {
|
|||
|
||||
bool FGAIBallistic::init() {
|
||||
FGAIBase::init();
|
||||
aero_stabilized = true;
|
||||
hdg = azimuth;
|
||||
pitch = elevation;
|
||||
roll = rotation;
|
||||
|
@ -84,8 +83,8 @@ void FGAIBallistic::setRoll(double rl) {
|
|||
rotation = rl;
|
||||
}
|
||||
|
||||
void FGAIBallistic::setStabilization(bool val) {
|
||||
aero_stabilized = val;
|
||||
void FGAIBallistic::setStabilisation(bool val) {
|
||||
aero_stabilised = val;
|
||||
}
|
||||
|
||||
void FGAIBallistic::setDragArea(double a) {
|
||||
|
@ -181,7 +180,8 @@ void FGAIBallistic::Run(double dt) {
|
|||
pos.setelev(altitude * SG_FEET_TO_METER);
|
||||
|
||||
// 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
|
||||
speed = sqrt( vs * vs + hs * hs);
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
void setAzimuth( double az );
|
||||
void setElevation( double el );
|
||||
void setRoll( double rl );
|
||||
void setStabilization( bool val );
|
||||
void setStabilisation( bool val );
|
||||
void setDragArea( double a );
|
||||
void setLife( double seconds );
|
||||
void setBuoyancy( double fpss );
|
||||
|
@ -57,7 +57,7 @@ private:
|
|||
double elevation; // degrees
|
||||
double rotation; // degrees
|
||||
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 life_timer; // seconds
|
||||
double gravity; // fps2
|
||||
|
|
|
@ -65,6 +65,7 @@ typedef struct {
|
|||
double cd; // coefficient of drag
|
||||
bool wind; // if true, model reacts to parent wind
|
||||
double mass; // in slugs
|
||||
bool aero_stabilised; // if true, ballistic object aligns with trajectory
|
||||
} FGAIModelEntity;
|
||||
|
||||
|
||||
|
|
|
@ -207,6 +207,7 @@ FGAIManager::createBallistic( FGAIModelEntity *entity ) {
|
|||
ai_ballistic->setRoll(entity->roll);
|
||||
ai_ballistic->setCd(entity->cd);
|
||||
ai_ballistic->setMass(entity->mass);
|
||||
ai_ballistic->setStabilisation(entity->aero_stabilised);
|
||||
ai_ballistic->init();
|
||||
ai_ballistic->bind();
|
||||
return ai_ballistic;
|
||||
|
|
|
@ -129,6 +129,7 @@ FGSubmodelMgr::release (submodel* sm, double dt)
|
|||
entity.wind = sm->wind;
|
||||
entity.cd = sm->cd;
|
||||
entity.mass = IC.mass;
|
||||
entity.aero_stabilised = sm->aero_stabilised;
|
||||
ai->createBallistic( &entity );
|
||||
|
||||
if (sm->count > 0) (sm->count)--;
|
||||
|
@ -184,6 +185,7 @@ FGSubmodelMgr::load ()
|
|||
sm->first_time = false;
|
||||
sm->cd = entry_node->getDoubleValue("cd", 0.193);
|
||||
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->trigger->setBoolValue(false);
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
double cd;
|
||||
double weight;
|
||||
double contents;
|
||||
bool aero_stabilised;
|
||||
} submodel;
|
||||
|
||||
typedef struct {
|
||||
|
|
Loading…
Reference in a new issue