FGAIShip::FGAIShip(object_type ot) :
FGAIBase(ot),
-_limit(40),
+_limit(100),
_elevation_m(0),
_elevation_ft(0),
_tow_angle(0),
_lead_angle(0),
_xtrack_error(0),
_tunnel(false),
+_initial_tunnel(false),
_curr_alt(0),
_prev_alt(0),
_until_time(""),
SGRawValuePointer<double>(&_fixed_turn_radius));
props->tie("controls/restart",
SGRawValuePointer<bool>(&_restart));
+ props->tie("velocities/speed-kts",
+ SGRawValuePointer<double>(&speed));
}
void FGAIShip::unbind() {
props->untie("controls/fixed-turn-radius-ft");
props->untie("controls/constants/speed");
props->untie("controls/restart");
+ props->untie("velocities/speed-kts");
}
void FGAIShip::update(double dt) {
}
// do not allow unreasonable speeds
- if (speed > _limit)
- speed = _limit;
+ SG_CLAMP_RANGE(speed, -_limit * 0.75, _limit);
// convert speed to degrees per second
speed_north_deg_sec = cos(hdg / SGD_RADIANS_TO_DEGREES)
//we assume that at slow speed ships will manoeuvre using engines/bow thruster
- if(type == "ship" || type == "carrier"){
+ if(type == "ship" || type == "carrier" || type == "escort"){
if (fabs(speed)<=5)
_sp_turn_radius_ft = _fixed_turn_radius;
}
// set the _rudder limit by speed
- if (type == "ship" || type == "carrier"){
+ if (type == "ship" || type == "carrier" || type == "escort"){
if (speed <= 40)
rudder_limit = (-0.825 * speed) + 35;