aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin
diff options
context:
space:
mode:
authorDahlia Trimble2009-02-12 07:58:10 +0000
committerDahlia Trimble2009-02-12 07:58:10 +0000
commitd21601d497e81108860e880653757dc3773cdb47 (patch)
tree1d444ac43c11d8f66e3193f6dce69fe7c63f0761 /OpenSim/Region/Physics/OdePlugin
parentSending this to Justin, so that he can see what's wrong with the StandaloneTe... (diff)
downloadopensim-SC_OLD-d21601d497e81108860e880653757dc3773cdb47.zip
opensim-SC_OLD-d21601d497e81108860e880653757dc3773cdb47.tar.gz
opensim-SC_OLD-d21601d497e81108860e880653757dc3773cdb47.tar.bz2
opensim-SC_OLD-d21601d497e81108860e880653757dc3773cdb47.tar.xz
Thanks Kitto Flora for a patch that adds automatic min fly height to ODE - Mantis #3134
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs12
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs18
2 files changed, 21 insertions, 9 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 2cdc988..b2981fe 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -832,8 +832,18 @@ namespace OpenSim.Region.Physics.OdePlugin
832 if (flying) 832 if (flying)
833 { 833 {
834 vec.Z += ((-1 * _parent_scene.gravityz)*m_mass); 834 vec.Z += ((-1 * _parent_scene.gravityz)*m_mass);
835 }
836 835
836 //Added for auto fly height. Kitto Flora
837 d.Vector3 pos = d.BodyGetPosition(Body);
838 float ground_height = _parent_scene.GetTerrainHeightAtXY(pos.X, pos.Y);
839 float target_altitude = ground_height + 3.0f; // This is the min fly height
840 if(pos.Z < target_altitude)
841 {
842 vec.Z += (target_altitude - pos.Z) * PID_P * 5.0f;
843 }
844 // end add Kitto Flora
845
846 }
837 847
838 doForce(vec); 848 doForce(vec);
839 } 849 }
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index d7d471f..0f18be4 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -1,3 +1,4 @@
1
1/* 2/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 3 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 4 * See CONTRIBUTORS.TXT for a full list of copyright holders.
@@ -205,7 +206,7 @@ namespace OpenSim.Region.Physics.OdePlugin
205 private float[] _watermap; 206 private float[] _watermap;
206 private bool m_filterCollisions = true; 207 private bool m_filterCollisions = true;
207 208
208 // private float[] _origheightmap; 209 private float[] _origheightmap; // Used for Fly height. Kitto Flora
209 210
210 private d.NearCallback nearCallback; 211 private d.NearCallback nearCallback;
211 public d.TriCallback triCallback; 212 public d.TriCallback triCallback;
@@ -1284,12 +1285,13 @@ namespace OpenSim.Region.Physics.OdePlugin
1284 } 1285 }
1285 1286
1286 #endregion 1287 #endregion
1287 1288
1288// TODO: unused 1289// Recovered for use by fly height. Kitto Flora
1289// private float GetTerrainHeightAtXY(float x, float y) 1290 public float GetTerrainHeightAtXY(float x, float y)
1290// { 1291 {
1291// return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x]; 1292 return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x];
1292// } 1293 }
1294// End recovered. Kitto Flora
1293 1295
1294 public void addCollisionEventReporting(PhysicsActor obj) 1296 public void addCollisionEventReporting(PhysicsActor obj)
1295 { 1297 {
@@ -2958,7 +2960,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2958 { 2960 {
2959 // this._heightmap[i] = (double)heightMap[i]; 2961 // this._heightmap[i] = (double)heightMap[i];
2960 // dbm (danx0r) -- creating a buffer zone of one extra sample all around 2962 // dbm (danx0r) -- creating a buffer zone of one extra sample all around
2961 // _origheightmap = heightMap; 2963 _origheightmap = heightMap; // Used for Fly height. Kitto Flora
2962 const uint heightmapWidth = m_regionWidth + 2; 2964 const uint heightmapWidth = m_regionWidth + 2;
2963 const uint heightmapHeight = m_regionHeight + 2; 2965 const uint heightmapHeight = m_regionHeight + 2;
2964 const uint heightmapWidthSamples = 2*m_regionWidth + 2; 2966 const uint heightmapWidthSamples = 2*m_regionWidth + 2;