]> git.mxchange.org Git - flightgear.git/commitdiff
Vivian Meazza:
authorehofman <ehofman>
Thu, 28 Oct 2004 08:29:15 +0000 (08:29 +0000)
committerehofman <ehofman>
Thu, 28 Oct 2004 08:29:15 +0000 (08:29 +0000)
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.

src/AIModel/AIBallistic.cxx
src/AIModel/AIBallistic.hxx
src/AIModel/AIBase.hxx
src/AIModel/AIManager.cxx
src/AIModel/submodel.cxx
src/AIModel/submodel.hxx

index 2a9f97e733993674164850c7e873cdb60c6ed249..86f1e3ad180624b139a41fef96c5dffdeddfb609 100644 (file)
@@ -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);
index 82309ea2b8bbb1ec62c613917c4f4cbbe6a720b9..c9df2a8d6510817a1eb90a6a4d8518a946f423fc 100644 (file)
@@ -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
index 190500d3ac0203f223d336078b36bc6cef5499eb..daf0caedbcb88472e3941ae4b9266172e22dc435 100644 (file)
@@ -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;
 
 
index 4faa4c269590c906563e94cd433d9cca330a81d0..a3d670e33f4148c656e82a5591553e38f0ce7744 100644 (file)
@@ -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;
index a9992885b204eddfbc2b233ad7bef02355478e15..b24e44eb8921a784bd5662abdbb348b9f4e50331 100644 (file)
@@ -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);
index dbddf39fdb9f625d29c6527ce1070135e4b978fb..e02233a0a11d8795cbe80119ad164b076149af6f 100644 (file)
@@ -52,6 +52,7 @@ public:
   double             cd;
   double             weight;
   double             contents;
+  bool               aero_stabilised;
  } submodel; 
 
  typedef struct {