From b4cdfed4064505b241fce0c273fa54ec628a081b Mon Sep 17 00:00:00 2001 From: mfranz Date: Mon, 11 Jun 2007 20:47:20 +0000 Subject: [PATCH] Vivian MEAZZA: simulate rotational moment of inertia by using a filter --- src/AIModel/AIBallistic.cxx | 18 ++++++++++++------ src/AIModel/submodel.cxx | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/AIModel/AIBallistic.cxx b/src/AIModel/AIBallistic.cxx index 6a135eb3b..723da1373 100644 --- a/src/AIModel/AIBallistic.cxx +++ b/src/AIModel/AIBallistic.cxx @@ -48,7 +48,8 @@ FGAIBallistic::FGAIBallistic() : _report_collision(false), _report_impact(false), _impact_report_node(fgGetNode("/ai/models/model-impact", true)), - _mat_name("") + _mat_name(""), + _elevation(0) { no_roll = false; } @@ -259,8 +260,8 @@ void FGAIBallistic::Run(double dt) { if (speed == 0.0) { hs = vs = 0.0; } else { - vs = sin( pitch * SG_DEGREES_TO_RADIANS ) * speed_fps; - hs = cos( pitch * SG_DEGREES_TO_RADIANS ) * speed_fps; + vs = sin( _elevation * SG_DEGREES_TO_RADIANS ) * speed_fps; + hs = cos( _elevation * SG_DEGREES_TO_RADIANS ) * speed_fps; } // convert horizontal speed (fps) to degrees per second @@ -290,12 +291,17 @@ void FGAIBallistic::Run(double dt) { altitude_ft += vs * dt; pos.setElevationFt(altitude_ft); - // recalculate pitch (velocity vector) if aerostabilized + // recalculate elevation (velocity vector) if aerostabilized /*cout << _name << ": " << "aero_stabilised " << _aero_stabilised << " pitch " << pitch <<" vs " << vs < 1) { IC.azimuth = atan2(IC.total_speed_east , IC.total_speed_north) * SG_RADIANS_TO_DEGREES; // cout << "azimuth1 " << IC.azimuth<= 360) IC.azimuth -= 360; - } // cout << "azimuth2 " << IC.azimuth<