Thanks Kitto Flora for a patch that adds automatic min fly height to ODE - Mantis #3134
parent
4ee99e2aab
commit
d21601d497
|
@ -61,6 +61,7 @@ Patches
|
|||
* Kayne
|
||||
* Kevin Cozens
|
||||
* kinoc (Daxtron Labs)
|
||||
* Kitto Flora
|
||||
* krtaylor (IBM)
|
||||
* lulurun
|
||||
* M.Igarashi
|
||||
|
|
|
@ -832,8 +832,18 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
if (flying)
|
||||
{
|
||||
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)
|
||||
{
|
||||
vec.Z += (target_altitude - pos.Z) * PID_P * 5.0f;
|
||||
}
|
||||
// end add Kitto Flora
|
||||
|
||||
}
|
||||
|
||||
doForce(vec);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
|
@ -205,7 +206,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
private float[] _watermap;
|
||||
private bool m_filterCollisions = true;
|
||||
|
||||
// private float[] _origheightmap;
|
||||
private float[] _origheightmap; // Used for Fly height. Kitto Flora
|
||||
|
||||
private d.NearCallback nearCallback;
|
||||
public d.TriCallback triCallback;
|
||||
|
@ -1285,11 +1286,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
#endregion
|
||||
|
||||
// TODO: unused
|
||||
// private float GetTerrainHeightAtXY(float x, float y)
|
||||
// {
|
||||
// return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x];
|
||||
// }
|
||||
// Recovered for use by fly height. Kitto Flora
|
||||
public float GetTerrainHeightAtXY(float x, float y)
|
||||
{
|
||||
return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x];
|
||||
}
|
||||
// End recovered. Kitto Flora
|
||||
|
||||
public void addCollisionEventReporting(PhysicsActor obj)
|
||||
{
|
||||
|
@ -2958,7 +2960,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
{
|
||||
// this._heightmap[i] = (double)heightMap[i];
|
||||
// dbm (danx0r) -- creating a buffer zone of one extra sample all around
|
||||
// _origheightmap = heightMap;
|
||||
_origheightmap = heightMap; // Used for Fly height. Kitto Flora
|
||||
const uint heightmapWidth = m_regionWidth + 2;
|
||||
const uint heightmapHeight = m_regionHeight + 2;
|
||||
const uint heightmapWidthSamples = 2*m_regionWidth + 2;
|
||||
|
|
Loading…
Reference in New Issue