+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "Math.hpp"
#include "BodyEnvironment.hpp"
#include "RigidBody.hpp"
-#include <simgear/scene/material/mat.hxx>
+#include <cfloat>
+#include <simgear/bvh/BVHMaterial.hxx>
#include <FDM/flight.hxx>
#include "Gear.hpp"
namespace yasim {
_extension = 1;
_castering = false;
_frac = 0;
- _ground_type = 0;
_ground_frictionFactor = 1;
_ground_rollingFriction = 0.02;
_ground_loadCapacity = 1e30;
void Gear::setGlobalGround(double *global_ground, float* global_vel,
double globalX, double globalY,
- int type, const SGMaterial *material)
+ const simgear::BVHMaterial *material)
{
int i;
double frictionFactor,rollingFriction,loadCapacity,loadResistance,bumpiness;
for(i=0; i<3; i++) _global_vel[i] = global_vel[i];
if (material) {
- loadCapacity = (*material).get_load_resistence();
+ loadCapacity = (*material).get_load_resistance();
frictionFactor =(*material).get_friction_factor();
rollingFriction = (*material).get_rolling_friction();
- loadResistance = (*material).get_load_resistence();
+ loadResistance = (*material).get_load_resistance();
bumpiness = (*material).get_bumpiness();
isSolid = (*material).get_solid();
} else {
- if (type == FGInterface::Solid) {
- loadCapacity = DBL_MAX;
- frictionFactor = 1.0;
- rollingFriction = 0.02;
- loadResistance = DBL_MAX;
- bumpiness = 0.0;
- isSolid = true;
- } else if (type == FGInterface::Water) {
- loadCapacity = DBL_MAX;
- frictionFactor = 1.0;
- rollingFriction = 2;
- loadResistance = DBL_MAX;
- bumpiness = 0.8;
- isSolid = false;
- } else {
- loadCapacity = DBL_MAX;
- frictionFactor = 0.9;
- rollingFriction = 0.1;
- loadResistance = DBL_MAX;
- bumpiness = 0.2;
- isSolid = true;
- }
+ // no material, assume solid
+ loadCapacity = DBL_MAX;
+ frictionFactor = 1.0;
+ rollingFriction = 0.02;
+ loadResistance = DBL_MAX;
+ bumpiness = 0.0;
+ isSolid = true;
}
- _ground_type = type;
_ground_frictionFactor = frictionFactor;
_ground_rollingFriction = rollingFriction;
_ground_loadCapacity = loadCapacity;
// Don't bother if it's not down
if(_extension < 1)
- return;
+ {
+ _wow = 0;
+ _frac = 0;
+ return;
+ }
// Dont bother if we are in the "wrong" ground
if (!((_onWater&&!_ground_isSolid)||(_onSolid&&_ground_isSolid))) {
- _wow = 0;
- _frac = 0;
+ _wow = 0;
+ _frac = 0;
_compressDist = 0;
_rollSpeed = 0;
_casterAngle = 0;
- return;
+ return;
}
// The ground plane transformed to the local frame.
float b = ground[3] - Math::dot3(tmp, ground)+BumpAltitude;
// Calculate the point of ground _contact.
- _frac = a/(a-b);
- if(b < 0) _frac = 1;
+ if(b < 0)
+ _frac = 1;
+ else
+ _frac = a/(a-b);
for(i=0; i<3; i++)
_contact[i] = _pos[i] + _frac*_cmpr[i];