setFixedTurnRadius(scFileNode->getDoubleValue("fixed-turn-radius-ft", 500));
setSpeedConstant(scFileNode->getDoubleValue("speed-constant", 0.5));
setSMPath(scFileNode->getStringValue("submodel-path", ""));
+ setRollFactor(scFileNode->getDoubleValue("roll-factor", 1));
if (!flightplan.empty()) {
SG_LOG(SG_AI, SG_ALERT, "getting flightplan: " << _name );
}
bool FGAIShip::init(bool search_in_AI_path) {
+ reinit();
+ return FGAIBase::init(search_in_AI_path);
+}
+
+void FGAIShip::reinit()
+{
prev = 0; // the one behind you
curr = 0; // the one ahead
next = 0; // the next plus 1
if (fp)
_fp_init = initFlightPlan();
- return FGAIBase::init(search_in_AI_path);
+ FGAIBase::reinit();
}
void FGAIShip::bind() {
props->untie("velocities/speed-kts");
}
+
void FGAIShip::update(double dt) {
//SG_LOG(SG_AI, SG_ALERT, "updating Ship: " << _name <<hdg<<pitch<<roll);
// For computation of rotation speeds we just use finite differences here.
// local frame
SGQuatd ec2body = ec2hl*hl2body;
// The cartesian position of the ship in the wgs84 world
- SGVec3d cartPos = SGVec3d::fromGeod(pos);
+ //SGVec3d cartPos = SGVec3d::fromGeod(pos);
// The simulation time this transform is meant for
aip.setReferenceTime(globals->get_sim_time_sec());
_fixed_turn_radius = ftr;
}
+void FGAIShip::setRollFactor(double rf) {
+ _roll_factor = rf * -0.0083335;
+}
+
void FGAIShip::setInitialTunnel(bool t) {
_initial_tunnel = t;
setTunnel(_initial_tunnel);