From 5a49c772ca41b92fe7b6e00858fa9add24b6d8a3 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sat, 7 Mar 2009 07:17:43 +0000 Subject: * Making the minimum ground offset for flying a configurable offset in the OpenSim.ini. This is the code that causes you to rise off the ground when you press the fly button and attempts to keep you above ground automatically when flying in a simulator. * minimum_ground_flight_offset, by default is 3 meters, as per Kitto Flora See OpenSim.ini.example for an example. --- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 13 ++++++++----- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 3 +++ bin/OpenSim.ini.example | 3 +++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index a62409c..1808fa0 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 7a01702..779ad1a 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 dd71b44..7f1c55b 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 ; ## -- cgit v1.1