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>
26 #include <simgear/scene/material/mat.hxx>
29 #include "AIManager.hxx"
35 class FGAIBallistic : public FGAIBase {
42 void readFromScenario(SGPropertyNode* scFileNode);
44 bool init(bool search_in_AI_path=false);
46 virtual void unbind();
48 void update(double dt);
50 void setAzimuth( double az );
51 void setElevation( double el );
52 void setRoll( double rl );
53 void setStabilisation( bool val );
54 void setDragArea( double a );
55 void setLife( double seconds );
56 void setBuoyancy( double fpss );
57 void setWind_from_east( double fps );
58 void setWind_from_north( double fps );
59 void setWind( bool val );
60 void setCd( double c );
61 void setMass( double m );
62 void setNoRoll( bool nr );
63 void setRandom( bool r );
64 void setName(const string&);
65 void setCollision(bool c);
66 void setImpact(bool i);
67 void setImpactReportNode(const string&);
68 void setFuseRange(double f);
69 void setSMPath(const string&);
71 void setSubmodel(const string&);
72 void setExternalForce( bool f );
73 void setForcePath(const string&);
74 double _getTime() const;
76 void setForceStabilisation( bool val );
77 void setXOffset(double x);
78 void setYOffset(double y);
79 void setZOffset(double z);
82 virtual const char* getTypeString(void) const { return "ballistic"; }
83 static const double slugs_to_kgs; //conversion factor
84 static const double slugs_to_lbs; //conversion factor
86 SGPropertyNode_ptr _force_node;
87 SGPropertyNode_ptr _force_azimuth_node;
88 SGPropertyNode_ptr _force_elevation_node;
92 double _azimuth; // degrees true
93 double _elevation; // degrees
94 double _rotation; // degrees
95 bool _aero_stabilised; // if true, object will align with trajectory
96 double _drag_area; // equivalent drag area in ft2
97 double _life_timer; // seconds
98 double _gravity; // fps2
99 double _buoyancy; // fps2
100 double _wind_from_east; // fps
101 double _wind_from_north; // fps
102 bool _wind; // if true, local wind will be applied to object
103 double _Cd; // drag coefficient
104 double _mass; // slugs
105 bool _random; // modifier for Cd
106 double _ht_agl_ft; // height above ground level
107 double _load_resistance; // ground load resistanc N/m^2
108 double _frictionFactor; // dimensionless modifier for Coefficient of Friction
109 bool _solid; // if true ground is solid for FDMs
110 double _elevation_m; // ground elevation in meters
111 bool _force_stabilised;// if true, object will align to external force
116 bool _report_collision; // if true a collision point with AI Objects is calculated
117 bool _report_impact; // if true an impact point on the terrain is calculated
118 bool _external_force; // if true then apply external force
120 SGPropertyNode_ptr _impact_report_node; // report node for impact and collision
132 const SGMaterial* _material;
135 void handle_collision();
136 void handle_impact();
137 void setPitch (double e, double dt, double c);
138 void setHdg (double dt, double c);
139 void report_impact(double elevation, const FGAIBase *target = 0);
141 double getRecip(double az);
145 #endif // _FG_AIBALLISTIC_HXX