X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAIModel%2FAIBase.cxx;h=8c5532db1131be92a5c3eb0033b063473f03f844;hb=cb10d714fd6fc685a48c82a46416b5234024dcd6;hp=a63751a1c9e0560f319cb4e8ab7211201996b864;hpb=e342d879e84003ee620d3da337f771954cd6bb9a;p=flightgear.git diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index a63751a1c..8c5532db1 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -82,6 +82,40 @@ FGAIBase::FGAIBase(object_type ot) : _impact_reported = false; _collision_reported = false; _subID = 0; + + _x_offset = 0; + _y_offset = 0; + _z_offset = 0; + + _pitch_offset = 0; + _roll_offset = 0; + _yaw_offset = 0; + + userpos = SGGeod::fromDeg(0, 0); + + pos = SGGeod::fromDeg(0, 0); + speed = 0; + altitude_ft = 0; + speed_north_deg_sec = 0; + speed_east_deg_sec = 0; + turn_radius_ft = 0; + + ft_per_deg_lon = 0; + ft_per_deg_lat = 0; + + horiz_offset = 0; + vert_offset = 0; + ht_diff = 0; + + serviceable = false; + + fp = 0; + + rho = 1; + T = 280; + p = 1e5; + a = 340; + Mach = 0; } FGAIBase::~FGAIBase() { @@ -191,8 +225,6 @@ bool FGAIBase::init(bool search_in_AI_path) { void FGAIBase::initModel(osg::Node *node) { if (model.valid()) { - // Disable altitude computations for general AI models. - model->setNodeMask(model->getNodeMask() & ~SG_NODEMASK_TERRAIN_BIT); fgSetString("/ai/models/model-added", props->getPath()); @@ -452,6 +484,12 @@ SGVec3d FGAIBase::getCartPos() const { return cartPos; } +bool FGAIBase::getGroundElevationM(const SGGeod& pos, double& elev, + const SGMaterial** material) const { + return globals->get_scenery()->get_elevation_m(pos, elev, material, + model.get()); +} + double FGAIBase::_getCartPosX() const { SGVec3d cartPos = getCartPos(); return cartPos.x();