1 // FGAIBallistic.hxx - AIBase derived class creates an AI ballistic object
3 // Written by David Culp, started November 2003.
4 // - davidculp2@comcast.net
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License as
8 // published by the Free Software Foundation; either version 2 of the
9 // License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef _FG_AIBALLISTIC_HXX
21 #define _FG_AIBALLISTIC_HXX
25 #include <simgear/structure/SGSharedPtr.hxx>
28 #include "AIManager.hxx"
34 class FGAIBallistic : public FGAIBase {
41 void readFromScenario(SGPropertyNode* scFileNode);
43 bool init(bool search_in_AI_path=false);
45 virtual void unbind();
47 void update(double dt);
49 void setAzimuth( double az );
50 void setElevation( double el );
51 void setRoll( double rl );
52 void setStabilisation( bool val );
53 void setDragArea( double a );
54 void setLife( double seconds );
55 void setBuoyancy( double fpss );
56 void setWind_from_east( double fps );
57 void setWind_from_north( double fps );
58 void setWind( bool val );
59 void setCd( double c );
60 void setMass( double m );
61 void setNoRoll( bool nr );
62 void setRandom( bool r );
63 void setName(const string&);
64 void setCollision(bool c);
65 void setImpact(bool i);
66 void setImpactReportNode(const string&);
67 void setFuseRange(double f);
68 void setSMPath(const string&);
70 void setSubmodel(const string&);
73 double _getTime() const;
75 virtual const char* getTypeString(void) const { return "ballistic"; }
76 static const double slugs_to_kgs; //conversion factor
80 double _azimuth; // degrees true
81 double _elevation; // degrees
82 double _rotation; // degrees
83 bool _aero_stabilised; // if true, object will align with trajectory
84 double _drag_area; // equivalent drag area in ft2
85 double _life_timer; // seconds
86 double _gravity; // fps2
87 double _buoyancy; // fps2
88 double _wind_from_east; // fps
89 double _wind_from_north; // fps
90 bool _wind; // if true, local wind will be applied to object
91 double _Cd; // drag coefficient
92 double _mass; // slugs
93 bool _random; // modifier for Cd
94 double _ht_agl_ft; // height above ground level
95 double _load_resistance; // ground load resistanc N/m^2
96 bool _solid; // if true ground is solid for FDMs
98 bool _report_collision; // if true a collision point with AI Objects is calculated
99 bool _report_impact; // if true an impact point on the terrain is calculated
101 SGPropertyNode_ptr _impact_report_node; // report node for impact and collision
113 void handle_collision();
114 void handle_impact();
116 void report_impact(double elevation, const FGAIBase *target = 0);
120 #endif // _FG_AIBALLISTIC_HXX