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&);
71 void setExternalForce( bool f );
72 void setForcePath(const string&);
73 double _getTime() const;
75 virtual const char* getTypeString(void) const { return "ballistic"; }
76 static const double slugs_to_kgs; //conversion factor
78 SGPropertyNode_ptr _force_node;
79 SGPropertyNode_ptr _force_azimuth_node;
80 SGPropertyNode_ptr _force_elevation_node;
84 double _azimuth; // degrees true
85 double _elevation; // degrees
86 double _rotation; // degrees
87 bool _aero_stabilised; // if true, object will align with trajectory
88 double _drag_area; // equivalent drag area in ft2
89 double _life_timer; // seconds
90 double _gravity; // fps2
91 double _buoyancy; // fps2
92 double _wind_from_east; // fps
93 double _wind_from_north; // fps
94 bool _wind; // if true, local wind will be applied to object
95 double _Cd; // drag coefficient
96 double _mass; // slugs
97 bool _random; // modifier for Cd
98 double _ht_agl_ft; // height above ground level
99 double _load_resistance; // ground load resistanc N/m^2
100 bool _solid; // if true ground is solid for FDMs
101 //double _hs_force_fps; // horizontal speed due to external force
103 bool _report_collision; // if true a collision point with AI Objects is calculated
104 bool _report_impact; // if true an impact point on the terrain is calculated
105 bool _external_force; // if true then apply external force
107 SGPropertyNode_ptr _impact_report_node; // report node for impact and collision
120 void handle_collision();
121 void handle_impact();
123 void report_impact(double elevation, const FGAIBase *target = 0);
127 #endif // _FG_AIBALLISTIC_HXX