2004-09-27 14:24:20 +00:00
|
|
|
// FGAIBallistic.hxx - AIBase derived class creates an AI ballistic object
|
2003-11-28 15:48:05 +00:00
|
|
|
//
|
|
|
|
// Written by David Culp, started November 2003.
|
|
|
|
// - davidculp2@comcast.net
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
2006-02-21 01:16:04 +00:00
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-11-28 15:48:05 +00:00
|
|
|
|
|
|
|
#ifndef _FG_AIBALLISTIC_HXX
|
|
|
|
#define _FG_AIBALLISTIC_HXX
|
|
|
|
|
|
|
|
#include "AIManager.hxx"
|
|
|
|
#include "AIBase.hxx"
|
|
|
|
|
|
|
|
|
|
|
|
class FGAIBallistic : public FGAIBase {
|
2004-09-22 08:47:05 +00:00
|
|
|
|
2003-11-28 15:48:05 +00:00
|
|
|
public:
|
2004-09-22 08:47:05 +00:00
|
|
|
|
2006-02-11 13:16:56 +00:00
|
|
|
FGAIBallistic();
|
2003-11-28 15:48:05 +00:00
|
|
|
~FGAIBallistic();
|
2004-09-22 08:47:05 +00:00
|
|
|
|
2006-02-11 13:16:56 +00:00
|
|
|
void readFromScenario(SGPropertyNode* scFileNode);
|
|
|
|
|
2007-01-13 16:04:28 +00:00
|
|
|
bool init(bool search_in_AI_path=false);
|
2003-12-21 20:12:55 +00:00
|
|
|
virtual void bind();
|
|
|
|
virtual void unbind();
|
2007-03-30 22:51:52 +00:00
|
|
|
|
2003-11-28 15:48:05 +00:00
|
|
|
void update(double dt);
|
|
|
|
|
|
|
|
void setAzimuth( double az );
|
|
|
|
void setElevation( double el );
|
2004-09-22 08:47:05 +00:00
|
|
|
void setRoll( double rl );
|
2004-10-28 08:29:15 +00:00
|
|
|
void setStabilisation( bool val );
|
2004-08-26 16:25:54 +00:00
|
|
|
void setDragArea( double a );
|
2004-08-30 09:11:59 +00:00
|
|
|
void setLife( double seconds );
|
2004-09-05 09:45:34 +00:00
|
|
|
void setBuoyancy( double fpss );
|
2004-09-08 14:02:25 +00:00
|
|
|
void setWind_from_east( double fps );
|
|
|
|
void setWind_from_north( double fps );
|
|
|
|
void setWind( bool val );
|
2004-09-22 08:47:05 +00:00
|
|
|
void setCd( double c );
|
2004-09-27 14:24:20 +00:00
|
|
|
void setMass( double m );
|
2007-03-30 22:51:52 +00:00
|
|
|
void setNoRoll( bool nr );
|
|
|
|
void setRandom( bool r );
|
|
|
|
void setName(const string&);
|
2007-05-15 16:19:11 +00:00
|
|
|
void setImpact(bool i);
|
2004-09-08 14:02:25 +00:00
|
|
|
|
|
|
|
double _getTime() const;
|
2004-09-22 08:47:05 +00:00
|
|
|
|
2006-02-11 13:16:56 +00:00
|
|
|
virtual const char* getTypeString(void) const { return "ballistic"; }
|
2007-05-15 16:19:11 +00:00
|
|
|
static const double slugs_to_kgs; //conversion factor
|
2006-02-11 13:16:56 +00:00
|
|
|
|
2003-11-28 15:48:05 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
double azimuth; // degrees true
|
|
|
|
double elevation; // degrees
|
2004-09-22 08:47:05 +00:00
|
|
|
double rotation; // degrees
|
2007-03-30 22:51:52 +00:00
|
|
|
bool aero_stabilised; // if true, object will align with trajectory
|
2004-08-26 16:25:54 +00:00
|
|
|
double drag_area; // equivalent drag area in ft2
|
2004-08-30 09:11:59 +00:00
|
|
|
double life_timer; // seconds
|
2004-09-08 14:02:25 +00:00
|
|
|
double gravity; // fps2
|
|
|
|
double buoyancy; // fps2
|
|
|
|
double wind_from_east; // fps
|
|
|
|
double wind_from_north; // fps
|
2007-05-15 16:19:11 +00:00
|
|
|
bool wind; // if true, local wind will be applied to object
|
2004-09-22 08:47:05 +00:00
|
|
|
double Cd; // drag coefficient
|
2004-09-27 14:24:20 +00:00
|
|
|
double mass; // slugs
|
2007-05-15 16:19:11 +00:00
|
|
|
bool random; // modifier for Cd
|
|
|
|
double ht_agl_ft; // height above ground level
|
|
|
|
double load_resistance; // ground load resistanc N/m^2
|
|
|
|
bool solid; // if true ground is solid for FDMs
|
|
|
|
bool impact; // if true an impact point on the terrain is calculated
|
|
|
|
bool impact_data; // if true impact data have been set
|
|
|
|
|
|
|
|
double impact_energy;
|
|
|
|
double impact_speed;
|
|
|
|
double impact_lat;
|
|
|
|
double impact_lon;
|
|
|
|
double impact_elev;
|
|
|
|
|
|
|
|
string mat_name;
|
2007-03-30 22:51:52 +00:00
|
|
|
string name;
|
2004-09-22 08:47:05 +00:00
|
|
|
|
2003-11-28 15:48:05 +00:00
|
|
|
void Run(double dt);
|
2007-05-15 16:19:11 +00:00
|
|
|
void handle_impact();
|
|
|
|
|
|
|
|
FGAIBase* ai;
|
2003-11-28 15:48:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _FG_AIBALLISTIC_HXX
|