SGVec3d pt_m = SGVec3d(pt) - max_altoff*ground_cache.get_down();
SGVec3d _contact, _normal, _linearVel, _angularVel;
material = 0;
- if (!ground_cache.get_agl(t, pt_m, _contact, _normal, _linearVel,
- _angularVel, id, material))
- return false;
+ bool ret = ground_cache.get_agl(t, pt_m, _contact, _normal, _linearVel,
+ _angularVel, id, material);
// correct the linear velocity, since the line intersector delivers
// values for the start point and the get_agl function should
// traditionally deliver for the contact point
assign(normal, _normal);
assign(linearVel, _linearVel);
assign(angularVel, _angularVel);
- return true;
+ return ret;
}
bool
pt_m *= SG_FEET_TO_METER;
SGVec3d _contact, _normal, _linearVel, _angularVel;
material = 0;
- if (!ground_cache.get_agl(t, pt_m, _contact, _normal, _linearVel,
- _angularVel, id, material))
- return false;
+ bool ret = ground_cache.get_agl(t, pt_m, _contact, _normal, _linearVel,
+ _angularVel, id, material);
// correct the linear velocity, since the line intersector delivers
// values for the start point and the get_agl function should
// traditionally deliver for the contact point
assign( normal, _normal );
assign( linearVel, SG_METER_TO_FEET*_linearVel );
assign( angularVel, _angularVel );
- return true;
+ return ret;
}
bool
SGGeod geodPt = SGGeod::fromCart(pt);
// Don't blow away the cache ground_radius and stuff if there's no
// scenery
- if (!globals->get_tile_mgr()->scenery_available(geodPt, rad))
+ if (!globals->get_tile_mgr()->scenery_available(geodPt, rad)) {
+ SG_LOG(SG_FLIGHT, SG_WARN, "prepare_ground_cache(): scenery_available "
+ "returns false at " << geodPt << " " << pt << " " << rad);
return false;
- _altitude = 0;
+ }
+ _material = 0;
// If we have an active wire, get some more area into the groundcache
if (_wire)
found_ground = true;
} else {
// Else do a crude scene query for the current point
+ double alt = 0;
found_ground = globals->get_scenery()->
- get_cart_elevation_m(pt, rad, _altitude, &_material);
+ get_cart_elevation_m(pt, rad, alt, &_material);
+ if (found_ground)
+ _altitude = alt;
}
// Still not sucessful??