diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index a62409ce21..1808fa0d1d 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -95,8 +95,11 @@ namespace OpenSim.Region.Physics.OdePlugin // taints and their non-tainted counterparts public bool m_isPhysical = false; // the current physical status public bool m_tainted_isPhysical = false; // set when the physical status is tainted (false=not existing in physics engine, true=existing) + public float MinimumGroundFlightOffset = 3f; + private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes. + private float m_buoyancy = 0f; // private CollisionLocker ode; @@ -834,12 +837,12 @@ namespace OpenSim.Region.Physics.OdePlugin vec.Z += ((-1 * _parent_scene.gravityz)*m_mass); //Added for auto fly height. Kitto Flora - d.Vector3 pos = d.BodyGetPosition(Body); - float ground_height = _parent_scene.GetTerrainHeightAtXY(pos.X, pos.Y); - float target_altitude = ground_height + 3.0f; // This is the min fly height - if (pos.Z < target_altitude) + //d.Vector3 pos = d.BodyGetPosition(Body); + float target_altitude = _parent_scene.GetTerrainHeightAtXY(_position.X, _position.Y) + MinimumGroundFlightOffset; + + if (_position.Z < target_altitude) { - vec.Z += (target_altitude - pos.Z) * PID_P * 5.0f; + vec.Z += (target_altitude - _position.Z) * PID_P * 5.0f; } // end add Kitto Flora diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 7a01702b8a..779ad1aadd 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -181,6 +181,7 @@ namespace OpenSim.Region.Physics.OdePlugin private float avHeightFudgeFactor = 0.52f; private float avMovementDivisorWalk = 1.3f; private float avMovementDivisorRun = 0.8f; + private float minimumGroundFlightOffset = 3f; public bool meshSculptedPrim = true; @@ -432,6 +433,7 @@ namespace OpenSim.Region.Physics.OdePlugin physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false); m_NINJA_physics_joints_enabled = physicsconfig.GetBoolean("use_NINJA_physics_joints", false); + minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", 3f); } } @@ -1336,6 +1338,7 @@ namespace OpenSim.Region.Physics.OdePlugin pos.Z = position.Z; OdeCharacter newAv = new OdeCharacter(avName, this, pos, ode, size, avPIDD, avPIDP, avCapRadius, avStandupTensor, avDensity, avHeightFudgeFactor, avMovementDivisorWalk, avMovementDivisorRun); newAv.Flying = isFlying; + newAv.MinimumGroundFlightOffset = minimumGroundFlightOffset; _characters.Add(newAv); return newAv; } diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index dd71b443a6..7f1c55be6e 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -463,6 +463,9 @@ InterregionComms = "RESTComms" ; speed of movement with Always Run on av_movement_divisor_run = 0.8 + ; When the avatar flies, it will be moved up by this amount off the ground (in meters) + minimum_ground_flight_offset = 3.0 + ; ## ; ## Object options ; ##