-FGInterface::get_agl_m(double t, const double pt[3],
- double contact[3], double normal[3], double vel[3],
- int *type, const SGMaterial **material, double *agl)
-{
- SGVec3d _contact, _normal, _vel;
- bool ret = ground_cache.get_agl(t, SGVec3d(pt), 2.0, _contact, _normal,
- _vel, type, material, agl);
+FGInterface::get_agl_m(double t, const double pt[3], double max_altoff,
+ double contact[3], double normal[3],
+ double linearVel[3], double angularVel[3],
+ SGMaterial const*& material, simgear::BVHNode::Id& id)
+{
+ SGVec3d pt_m = SGVec3d(pt) - max_altoff*ground_cache.get_down();
+ SGVec3d _contact, _normal, _linearVel, _angularVel;
+ material = 0;
+ 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
+ _linearVel += cross(_angularVel, _contact - pt_m);
+