Am Freitag, den 22.12.2006, 22:35 +0100 schrieb Maik Justus:
> Hi,
>
> here is a patch for the head/osg-branch. But unfortunately it does not
> work here. It seems, that
> FGGroundCache::get_agl(double t, const SGVec3d& dpt, double max_altoff,
> SGVec3d& contact, SGVec3d& normal, SGVec3d& vel,
> int *type, const SGMaterial** material, double *agl)
> does not return the material.
>
> Does anyone know, if this is not supported in osg?
>
> Or is it OS-dependent?
>
While compiling with your patch on Gentoo Linux I get:
FGGround.cpp:70: Fehler: redefinition of `void
yasim::FGGround::getGroundPlane(const double*, double*, float*, int*,
double*, double*, double*, double*, double*, bool*)'
FGGround.cpp:47: Fehler: »virtual void
yasim::FGGround::getGroundPlane(const double*, double*, float*, int*,
double*, double*, double*, double*, double*, bool*)« wurde vorher hier
definiert
make[3]: *** [FGGround.o] Fehler 1
make[3]: Leaving directory `/home/don/work/fg_cvs/source/src/FDM/YASim'
make[2]: *** [all-recursive] Fehler 1
make[2]: Leaving directory `/home/don/work/fg_cvs/source/src/FDM'
make[1]: *** [all-recursive] Fehler 1
make[1]: Leaving directory `/home/don/work/fg_cvs/source/src'
make: *** [all-recursive] Fehler 1
It is a OSG-FG CVS of today, the unpatched FG compiles and runs fine.
Greetings
Detlef
> Maik
>
>
> Maik Justus schrieb am 22.12.2006 19:02:
> > Hi,
> >
> > osg and plib branch differ in some details. My patch works only on the
> > plib-branch. I hope I find the time to patch the head/osg-branch tonight.
> >
> > Maik
> >
>
> einfaches Textdokument-Anlage (gear.osg.diff)
> ? df.bat
> ? gear.diff
> ? gear.osg.diff
> Index: flight.cxx
> ===================================================================
> RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/flight.cxx,v
> retrieving revision 1.29
> diff -u -p -r1.29 flight.cxx
> --- flight.cxx 29 Oct 2006 19:30:24 -0000 1.29
> +++ flight.cxx 22 Dec 2006 21:10:58 -0000
> @@ -883,6 +883,39 @@ FGInterface::get_agl_m(double t, const d
> return ret;
> }
>
> +bool
> +FGInterface::get_agl_m(double t, const double pt[3],
> + double contact[3], double normal[3], double vel[3],
> + int *type, double *loadCapacity,
> + double *frictionFactor, double *agl,
> + double *rollingFritction, double *loadResistance,
> + double *bumpiness, bool *isSolid)
> +{
> + const SGMaterial* material;
> + SGVec3d _contact, _normal, _vel;
> + bool ret = ground_cache.get_agl(t, SGVec3d(pt), 2.0, _contact, _normal,
> + _vel, type, &material, agl);
> + sgdCopyVec3(contact, _contact.data());
> + sgdCopyVec3(normal, _normal.data());
> + sgdCopyVec3(vel, _vel.data());
> + if (material) {
> + *loadCapacity = material->get_load_resistence();
> + *frictionFactor = material->get_friction_factor();
> + *rollingFritction = material->get_rolling_friction();
> + *loadResistance = material->get_load_resistence();
> + *bumpiness = material->get_bumpiness();
> + *isSolid = material->get_solid();
> + } else {
> + *loadCapacity = DBL_MAX;
> + *frictionFactor = 1.0;
> + *rollingFritction = 0.02;
> + *loadResistance = DBL_MAX;
> + *bumpiness = 0.0;
> + *isSolid = true;
> + }
> + return ret;
> +}
> +
> // Legacy interface just kept because of JSBSim
> bool
> FGInterface::get_agl_ft(double t, const double pt[3],
> Index: flight.hxx
> ===================================================================
> RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/flight.hxx,v
> retrieving revision 1.13
> diff -u -p -r1.13 flight.hxx
> --- flight.hxx 11 Jun 2006 13:34:19 -0000 1.13
> +++ flight.hxx 22 Dec 2006 21:11:03 -0000
> @@ -1128,6 +1128,12 @@ public:
> double contact[3], double normal[3], double vel[3],
> int *type, double *loadCapacity,
> double *frictionFactor, double *agl);
> + bool get_agl_m(double t, const double pt[3],
> + double contact[3], double normal[3], double vel[3],
> + int *type, double *loadCapacity,
> + double *frictionFactor, double *agl,
> + double *rollingFritction, double *loadResistance,
> + double *bumpiness,bool *isSolid);
> bool get_agl_ft(double t, const double pt[3],
> double contact[3], double normal[3], double vel[3],
> int *type, double *loadCapacity,
> Index: YASim/Airplane.cpp
> ===================================================================
> RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/Airplane.cpp,v
> retrieving revision 1.22
> diff -u -p -r1.22 Airplane.cpp
> --- YASim/Airplane.cpp 22 Dec 2006 18:02:17 -0000 1.22
> +++ YASim/Airplane.cpp 22 Dec 2006 21:11:08 -0000
> @@ -602,6 +602,7 @@ void Airplane::compileContactPoints()
> // I made these up
> g->setStaticFriction(0.6f);
> g->setDynamicFriction(0.5f);
> + g->setContactPoint(1);
>
> _model.addGear(g);
> }
> Index: YASim/FGFDM.cpp
> ===================================================================
> RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/FGFDM.cpp,v
> retrieving revision 1.45
> diff -u -p -r1.45 FGFDM.cpp
> --- YASim/FGFDM.cpp 18 Dec 2006 21:22:20 -0000 1.45
> +++ YASim/FGFDM.cpp 22 Dec 2006 21:11:11 -0000
> @@ -273,6 +273,10 @@ void FGFDM::startElement(const char* nam
> g->setDynamicFriction(attrf(a, "dfric", 0.7));
> g->setSpring(attrf(a, "spring", 1));
> g->setDamping(attrf(a, "damp", 1));
> + if(attrb(a,"on-water"))g->setOnWater(1);
> + if(attrb(a,"on-solid"))g->setOnSolid(1);
> + g->setInverseSpeedSpringIsDoubled(attrf(a,
> "inverse-speed-spring-is-doubled", 0));
> + g->setReduceFrictionByExtension(attrf(a,
> "reduce-friction-by-extension", 0));
> _airplane.addGear(g);
> } else if(eq(name, "hook")) {
> Hook* h = new Hook();
> Index: YASim/FGGround.cpp
> ===================================================================
> RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/FGGround.cpp,v
> retrieving revision 1.2
> diff -u -p -r1.2 FGGround.cpp
> --- YASim/FGGround.cpp 18 Feb 2005 12:40:39 -0000 1.2
> +++ YASim/FGGround.cpp 22 Dec 2006 21:11:12 -0000
> @@ -35,6 +35,29 @@ void FGGround::getGroundPlane(const doub
> for(int i=0; i<3; i++) vel[i] = dvel[i];
> }
>
> +void FGGround::getGroundPlane(const double pos[3],
> + double plane[4], float vel[3],
> + int *type,
> + double *frictionFactor,
> + double *rollingFriction,
> + double *loadCapacity,
> + double *loadResistance,
> + double *bumpiness,
> + bool *isSolid)
> +{
> + // Return values for the callback.
> + double agl;
> + double cp[3], dvel[3];
> + _iface->get_agl_m(_toff, pos, cp, plane, dvel,
> + type, loadCapacity, frictionFactor, &agl,
> + rollingFriction,loadResistance,bumpiness,isSolid);
> +
> + // The plane below the actual contact point.
> + plane[3] = plane[0]*cp[0] + plane[1]*cp[1] + plane[2]*cp[2];
> +
> + for(int i=0; i<3; i++) vel[i] = dvel[i];
> +}
> +
> bool FGGround::caughtWire(const double pos[4][3])
> {
> return _iface->caught_wire_m(_toff, pos);
> Index: YASim/FGGround.hpp
> ===================================================================
> RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/FGGround.hpp,v
> retrieving revision 1.1
> diff -u -p -r1.1 FGGround.hpp
> --- YASim/FGGround.hpp 17 Feb 2005 10:37:26 -0000 1.1
> +++ YASim/FGGround.hpp 22 Dec 2006 21:11:12 -0000
> @@ -18,6 +18,16 @@ public:
> virtual void getGroundPlane(const double pos[3],
> double plane[4], float vel[3]);
>
> + virtual void getGroundPlane(const double pos[3],
> + double plane[4], float vel[3],
> + int *type,
> + double *frictionFactor,
> + double *rollingFriction,
> + double *loadCapacity,
> + double *loadResistance,
> + double *bumpiness,
> + bool *isSolid);
> +
> virtual bool caughtWire(const double pos[4][3]);
>
> virtual bool getWire(double end[2][3], float vel[2][3]);
> Index: YASim/Gear.cpp
> ===================================================================
> RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/Gear.cpp,v
> retrieving revision 1.7
> diff -u -p -r1.7 Gear.cpp
> --- YASim/Gear.cpp 24 Nov 2005 17:35:42 -0000 1.7
> +++ YASim/Gear.cpp 22 Dec 2006 21:11:13 -0000
> @@ -4,6 +4,9 @@
>
> #include "Gear.hpp"
> namespace yasim {
> +static const float YASIM_PI = 3.14159265358979323846;
> +static const float maxGroundBumpAmplitude=0.5;
> + //Amplitude can be positive and negative
>
> Gear::Gear()
> {
> @@ -19,6 +22,20 @@ Gear::Gear()
> _extension = 1;
> _castering = false;
> _frac = 0;
> + _ground_type = 0;
> + _ground_frictionFactor = 1;
> + _ground_rollingFriction = 0.02;
> + _ground_loadCapacity = 1e30;
> + _ground_loadResistance = 1e30;
> + _ground_isSolid=1;
> + _ground_bumpiness = 0;
> + _onWater=0;
> + _onSolid=1;
> + _global_x=0.0;
> + _global_y=0.0;
> + _inverseSpeedSpringIsDoubled=0;
> + _reduceFrictionByExtension=0;
> + _isContactPoint=0;
>
> for(i=0; i<3; i++)
> _global_ground[i] = _global_vel[i] = 0;
> @@ -78,11 +95,51 @@ void Gear::setCastering(bool c)
> _castering = c;
> }
>
> -void Gear::setGlobalGround(double *global_ground, float* global_vel)
> +void Gear::setContactPoint(bool c)
> +{
> + _isContactPoint=c;
> +}
> +
> +void Gear::setOnWater(bool c)
> +{
> + _onWater = c;
> +}
> +
> +void Gear::setOnSolid(bool c)
> +{
> + _onSolid = c;
> +}
> +
> +void Gear::setInverseSpeedSpringIsDoubled(float s)
> +{
> + _inverseSpeedSpringIsDoubled=s;
> +}
> +
> +void Gear::setReduceFrictionByExtension(float s)
> +{
> + _reduceFrictionByExtension=s;
> +}
> +
> +void Gear::setGlobalGround(double *global_ground, float* global_vel,
> + double globalX, double globalY,
> + int type, double frictionFactor,
> + double rollingFriction, double loadCapacity,
> + double loadResistance, double bumpiness,
> + bool isSolid)
> {
> int i;
> for(i=0; i<4; i++) _global_ground[i] = global_ground[i];
> for(i=0; i<3; i++) _global_vel[i] = global_vel[i];
> + _ground_type = type;
> + _ground_frictionFactor=frictionFactor;
> + _ground_rollingFriction=rollingFriction;
> + _ground_loadCapacity=loadCapacity;
> + _ground_loadResistance=loadResistance;
> + _ground_bumpiness=bumpiness;
> + _ground_isSolid=isSolid;
> + _global_x=globalX;
> + _global_y=globalY;
> +
> }
>
> void Gear::getPosition(float* out)
> @@ -159,6 +216,31 @@ bool Gear::getCastering()
> return _castering;
> }
>
> +bool Gear::getGroundIsSolid()
> +{
> + return _ground_isSolid;
> +}
> +
> +float Gear::getBumbAltitude()
> +{
> + if (_ground_bumpiness<0.001) return 0.0;
> + double x = _global_x*10;
> + double y = _global_y*10;
> + x-=Math::floor(x);
> + y-=Math::floor(y);
> + x*=2*YASIM_PI;
> + y*=2*YASIM_PI;
> + //now x and y are in the range of 0..2pi
> + //we need a function, that is periodically on 2pi and gives some
> + //height. This is not very fast, but for a beginning.
> + //maybe this should be done by interpolating between some precalculated
> + //values
> + float h= Math::sin(x)+Math::sin(7*x)+Math::sin(8*x)+Math::sin(13*x);
> + h+= Math::sin(2*y)+Math::sin(5*y)+Math::sin(9*y*x)+Math::sin(17*y);
> +
> + return h *(1/8.)*_ground_bumpiness*maxGroundBumpAmplitude;
> +}
> +
> void Gear::calcForce(RigidBody* body, State *s, float* v, float* rot)
> {
> // Init the return values
> @@ -169,6 +251,15 @@ void Gear::calcForce(RigidBody* body, St
> if(_extension < 1)
> return;
>
> + if (!((_onWater&&!_ground_isSolid)||(_onSolid&&_ground_isSolid))) {
> + _wow = 0;
> + _frac = 0;
> + _compressDist = 0;
> + _rollSpeed = 0;
> + _casterAngle = 0;
> + return;
> + }
> +
> // The ground plane transformed to the local frame.
> float ground[4];
> s->planeGlobalToLocal(_global_ground, ground);
> @@ -180,6 +271,12 @@ void Gear::calcForce(RigidBody* body, St
> // First off, make sure that the gear "tip" is below the ground.
> // If it's not, there's no force.
> float a = ground[3] - Math::dot3(_pos, ground);
> + float BumbAltitude=0;
> + if (a<maxGroundBumpAmplitude)
> + {
> + BumbAltitude=getBumbAltitude();
> + a+=BumbAltitude;
> + }
> _compressDist = -a;
> if(a > 0) {
> _wow = 0;
> @@ -196,7 +293,7 @@ void Gear::calcForce(RigidBody* body, St
> // above ground is negative.
> float tmp[3];
> Math::add3(_cmpr, _pos, tmp);
> - float b = ground[3] - Math::dot3(tmp, ground);
> + float b = ground[3] - Math::dot3(tmp, ground)+BumbAltitude;
>
> // Calculate the point of ground _contact.
> _frac = a/(a-b);
> @@ -219,7 +316,11 @@ void Gear::calcForce(RigidBody* body, St
> // compression. (note the clamping of _frac to 1):
> _frac = (_frac > 1) ? 1 : _frac;
> float fmag = _frac*clen*_spring;
> -
> + float inversespeed_multiplied_by_speed=0;
> + if (_inverseSpeedSpringIsDoubled>0.0000001) {
> +
> inversespeed_multiplied_by_speed=Math::mag3(cv)*_inverseSpeedSpringIsDoubled;
> + fmag*=1+inversespeed_multiplied_by_speed;
> + }
> // Then the damping. Use the only the velocity into the ground
> // (projection along "ground") projected along the compression
> // axis. So Vdamp = ground*(ground dot cv) dot cmpr
> @@ -284,11 +385,28 @@ void Gear::calcForce(RigidBody* body, St
> _rollSpeed = vsteer;
> _casterAngle = _rot;
> }
> -
> - float fsteer = _brake * calcFriction(wgt, vsteer);
> - float fskid = calcFriction(wgt, vskid);
> + float fsteer,fskid;
> + if(_ground_isSolid)
> + {
> + fsteer = (_brake * _ground_frictionFactor
> + +(1-_brake)*_ground_rollingFriction
> + )*calcFriction(wgt, vsteer);
> + fskid = calcFriction(wgt, vskid)*_ground_frictionFactor;
> + }
> + else
> + {
> + fsteer = _ground_frictionFactor *calcFrictionV2(wgt, vsteer);
> + fskid = calcFrictionV2(wgt, vskid)*_ground_frictionFactor;
> + }
> if(vsteer > 0) fsteer = -fsteer;
> if(vskid > 0) fskid = -fskid;
> +
> + //reduce friction if wanted by _reduceFrictionByExtension
> + //float factor =
> 1-inversespeed_multiplied_by_speed*_reduceFrictionByExtension;
> + float factor = (1-_frac)*(1-_reduceFrictionByExtension)+_frac*1;
> + factor=Math::clamp(factor,0,1);
> + fsteer*=factor;
> + fskid*=factor;
>
> // Phoo! All done. Add it up and get out of here.
> Math::mul3(fsteer, steer, tmp);
> @@ -308,5 +426,14 @@ float Gear::calcFriction(float wgt, floa
> else return wgt * _dfric;
> }
>
> +float Gear::calcFrictionV2(float wgt, float v)
> +{
> + // How slow is stopped? 10 cm/second?
> + const float STOP = 0.1f;
> + const float iSTOP = 1.0f/STOP;
> + v = Math::abs(v);
> + if(v < STOP) return v*iSTOP * wgt * _sfric;
> + else return wgt * _dfric*v*v*0.01;
> +}
> }; // namespace yasim
>
> Index: YASim/Gear.hpp
> ===================================================================
> RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/Gear.hpp,v
> retrieving revision 1.5
> diff -u -p -r1.5 Gear.hpp
> --- YASim/Gear.hpp 24 Nov 2005 17:35:42 -0000 1.5
> +++ YASim/Gear.hpp 22 Dec 2006 21:11:13 -0000
> @@ -39,8 +39,15 @@ public:
> void setRotation(float rotation);
> void setExtension(float extension);
> void setCastering(bool castering);
> - void setGlobalGround(double* global_ground, float* global_vel);
> -
> + void setOnWater(bool c);
> + void setOnSolid(bool c);
> + void setInverseSpeedSpringIsDoubled(float s);
> + void setReduceFrictionByExtension(float s);
> + void setGlobalGround(double* global_ground, float* global_vel,
> + double globalX, double globalY,
> + int type, double frictionFactor,double rollingFriction,
> + double loadCapacity, double loadResistance, double bumpiness,
> + bool isSolid);
> void getPosition(float* out);
> void getCompression(float* out);
> void getGlobalGround(double* global_ground);
> @@ -54,6 +61,8 @@ public:
> bool getCastering();
> float getCasterAngle() { return _casterAngle; }
> float getRollSpeed() { return _rollSpeed; }
> + float getBumbAltitude();
> + bool getGroundIsSolid();
>
> // Takes a velocity of the aircraft relative to ground, a rotation
> // vector, and a ground plane (all specified in local coordinates)
> @@ -67,9 +76,12 @@ public:
> float getWoW();
> float getCompressFraction();
> float getCompressDist() { return _compressDist; }
> + bool getIgnoreAtCrashDetection() {return
> (!_ground_isSolid)&&(!_isContactPoint); }
> + void setContactPoint(bool c);
>
> private:
> float calcFriction(float wgt, float v);
> + float calcFrictionV2(float wgt, float v);
>
> bool _castering;
> float _pos[3];
> @@ -90,6 +102,21 @@ private:
> float _global_vel[3];
> float _casterAngle;
> float _rollSpeed;
> + bool _isContactPoint;
> + bool _onWater;
> + bool _onSolid;
> + float _inverseSpeedSpringIsDoubled;
> + float _reduceFrictionByExtension;
> +
> + int _ground_type;
> + double _ground_frictionFactor;
> + double _ground_rollingFriction;
> + double _ground_loadCapacity;
> + double _ground_loadResistance;
> + double _ground_bumpiness;
> + bool _ground_isSolid;
> + double _global_x;
> + double _global_y;
> };
>
> }; // namespace yasim
> Index: YASim/Ground.cpp
> ===================================================================
> RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/Ground.cpp,v
> retrieving revision 1.1
> diff -u -p -r1.1 Ground.cpp
> --- YASim/Ground.cpp 17 Feb 2005 10:37:26 -0000 1.1
> +++ YASim/Ground.cpp 22 Dec 2006 21:11:13 -0000
> @@ -28,6 +28,19 @@ void Ground::getGroundPlane(const double
> vel[2] = 0.0;
> }
>
> +void Ground::getGroundPlane(const double pos[3],
> + double plane[4], float vel[3],
> + int *type,
> + double *frictionFactor,
> + double *rollingFriction,
> + double *loadCapacity,
> + double *loadResistance,
> + double *bumpiness,
> + bool *isSolid)
> +{
> + getGroundPlane(pos,plane,vel);
> +}
> +
> bool Ground::caughtWire(const double pos[4][3])
> {
> return false;
> Index: YASim/Ground.hpp
> ===================================================================
> RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/Ground.hpp,v
> retrieving revision 1.1
> diff -u -p -r1.1 Ground.hpp
> --- YASim/Ground.hpp 17 Feb 2005 10:37:26 -0000 1.1
> +++ YASim/Ground.hpp 22 Dec 2006 21:11:14 -0000
> @@ -11,6 +11,16 @@ public:
> virtual void getGroundPlane(const double pos[3],
> double plane[4], float vel[3]);
>
> + virtual void getGroundPlane(const double pos[3],
> + double plane[4], float vel[3],
> + int *type,
> + double *frictionFactor,
> + double *rollingFriction,
> + double *loadCapacity,
> + double *loadResistance,
> + double *bumpiness,
> + bool *isSolid);
> +
> virtual bool caughtWire(const double pos[4][3]);
>
> virtual bool getWire(double end[2][3], float vel[2][3]);
> Index: YASim/Model.cpp
> ===================================================================
> RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/Model.cpp,v
> retrieving revision 1.13
> diff -u -p -r1.13 Model.cpp
> --- YASim/Model.cpp 14 Sep 2006 18:18:33 -0000 1.13
> +++ YASim/Model.cpp 22 Dec 2006 21:11:15 -0000
> @@ -13,7 +13,12 @@
> #include "Rotorpart.hpp"
> #include "Glue.hpp"
> #include "Ground.hpp"
> -
> +/*
> +#include <stdio.h>
> +#include <iostream>
> +#include <sstream>
> +#include <simgear/debug/logstream.hxx>
> +*/
> #include "Model.hpp"
> namespace yasim {
>
> @@ -307,8 +312,26 @@ void Model::updateGround(State* s)
> // Ask for the ground plane in the global coordinate system
> double global_ground[4];
> float global_vel[3];
> - _ground_cb->getGroundPlane(pt, global_ground, global_vel);
> - g->setGlobalGround(global_ground, global_vel);
> + int type;
> + double frictionFactor, rollingFriction, loadCapacity,
> + loadResistance, bumpiness;
> + bool isSolid;
> + //_ground_cb->getGroundPlane(pt, global_ground, global_vel);
> + _ground_cb->getGroundPlane(pt, global_ground, global_vel,
> + &type,&frictionFactor, &rollingFriction,
> + &loadCapacity,
> &loadResistance,&bumpiness,&isSolid);
> + static int h=0;
> + /*
> + if (h++>100)
> + {
> + cout<<"t:"<<type<<"fF:"<<frictionFactor<<"rF:"<<rollingFriction
> + <<"lC:"<<loadCapacity<<"lR"<<loadResistance<<"b:"<<bumpiness<<"
> \r";
> + h=0;
> + }
> + */
> + g->setGlobalGround(global_ground, global_vel, pt[0], pt[1],type,
> + frictionFactor, rollingFriction, loadCapacity, loadResistance,
> + bumpiness,isSolid);
> }
> for(i=0; i<_rotorgear.getRotors()->size(); i++) {
> Rotor* r = (Rotor*)_rotorgear.getRotors()->get(i);
> @@ -480,23 +503,26 @@ void Model::newState(State* s)
> for(i=0; i<_gears.size(); i++) {
> Gear* g = (Gear*)_gears.get(i);
>
> - // Get the point of ground contact
> - float pos[3], cmpr[3];
> - g->getPosition(pos);
> - g->getCompression(cmpr);
> - Math::mul3(g->getCompressFraction(), cmpr, cmpr);
> - Math::add3(cmpr, pos, pos);
> -
> - // The plane transformed to local coordinates.
> - double global_ground[4];
> - g->getGlobalGround(global_ground);
> - float ground[4];
> - s->planeGlobalToLocal(global_ground, ground);
> - float dist = ground[3] - Math::dot3(pos, ground);
> -
> - // Find the lowest one
> - if(dist < min)
> - min = dist;
> + if (!g->getIgnoreAtCrashDetection())
> + {
> + // Get the point of ground contact
> + float pos[3], cmpr[3];
> + g->getPosition(pos);
> + g->getCompression(cmpr);
> + Math::mul3(g->getCompressFraction(), cmpr, cmpr);
> + Math::add3(cmpr, pos, pos);
> +
> + // The plane transformed to local coordinates.
> + double global_ground[4];
> + g->getGlobalGround(global_ground);
> + float ground[4];
> + s->planeGlobalToLocal(global_ground, ground);
> + float dist = ground[3] - Math::dot3(pos, ground);
> +
> + // Find the lowest one
> + if(dist < min)
> + min = dist;
> + }
> }
> _agl = min;
> if(_agl < -1) // Allow for some integration slop
> Index: YASim/YASim.cxx
> ===================================================================
> RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/YASim.cxx,v
> retrieving revision 1.37
> diff -u -p -r1.37 YASim.cxx
> --- YASim/YASim.cxx 9 Dec 2006 20:37:59 -0000 1.37
> +++ YASim/YASim.cxx 22 Dec 2006 21:11:17 -0000
> @@ -477,6 +477,7 @@ void YASim::copyFromYASim()
> node->setFloatValue("compression-m", g->getCompressDist());
> node->setFloatValue("caster-angle-deg", g->getCasterAngle() *
> RAD2DEG);
> node->setFloatValue("rollspeed-ms", g->getRollSpeed());
> + node->setBoolValue("ground-is-solid", g->getGroundIsSolid()!=0);
> }
>
> Hook* h = airplane->getHook();
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________ Flightgear-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel