* Fixes colliding with the terrain lower then 0 and higher then 256m
* The actual AABB of the heightfield on the Z is now determined by the minimum and maximum heightfield value in the terrain array (assuming it's a reasonable number). This might optimize collisions in simulators that have a small difference between minimum and maximum heightfield values.0.6.3-post-fixes
parent
665269a277
commit
08a9a85376
|
@ -298,6 +298,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
world = d.WorldCreate();
|
world = d.WorldCreate();
|
||||||
space = d.HashSpaceCreate(IntPtr.Zero);
|
space = d.HashSpaceCreate(IntPtr.Zero);
|
||||||
|
|
||||||
|
|
||||||
contactgroup = d.JointGroupCreate(0);
|
contactgroup = d.JointGroupCreate(0);
|
||||||
//contactgroup
|
//contactgroup
|
||||||
|
|
||||||
|
@ -484,6 +485,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
|
d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
|
||||||
//d.WorldSetContactMaxCorrectingVel(world, 1000.0f);
|
//d.WorldSetContactMaxCorrectingVel(world, 1000.0f);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < staticPrimspace.GetLength(0); i++)
|
for (int i = 0; i < staticPrimspace.GetLength(0); i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < staticPrimspace.GetLength(1); j++)
|
for (int j = 0; j < staticPrimspace.GetLength(1); j++)
|
||||||
|
@ -2900,15 +2903,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
m_log.Warn("[PHYSICS]: Non finite heightfield element detected. Setting it to 0");
|
m_log.Warn("[PHYSICS]: Non finite heightfield element detected. Setting it to 0");
|
||||||
resultarr2[y, x] = 0;
|
resultarr2[y, x] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resultarr2[y, x] <= 0)
|
|
||||||
{
|
|
||||||
returnarr[i] = 0.0000001f;
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
returnarr[i] = resultarr2[y, x];
|
returnarr[i] = resultarr2[y, x];
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2934,7 +2929,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
//Double resolution
|
//Double resolution
|
||||||
heightMap = ResizeTerrain512Interpolation(heightMap);
|
heightMap = ResizeTerrain512Interpolation(heightMap);
|
||||||
|
float hfmin = 2000;
|
||||||
|
float hfmax = -2000;
|
||||||
for (int x = 0; x < heightmapWidthSamples; x++)
|
for (int x = 0; x < heightmapWidthSamples; x++)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < heightmapHeightSamples; y++)
|
for (int y = 0; y < heightmapHeightSamples; y++)
|
||||||
|
@ -2944,6 +2940,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
float val = heightMap[yy*512 + xx];
|
float val = heightMap[yy*512 + xx];
|
||||||
_heightmap[x*heightmapHeightSamples + y] = val;
|
_heightmap[x*heightmapHeightSamples + y] = val;
|
||||||
|
hfmin = (val < hfmin) ? val : hfmin;
|
||||||
|
hfmax = (val > hfmax) ? val : hfmax;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2957,7 +2955,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0, heightmapWidth, heightmapHeight,
|
d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0, heightmapWidth, heightmapHeight,
|
||||||
(int) heightmapWidthSamples, (int) heightmapHeightSamples, scale,
|
(int) heightmapWidthSamples, (int) heightmapHeightSamples, scale,
|
||||||
offset, thickness, wrap);
|
offset, thickness, wrap);
|
||||||
d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight);
|
d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1 , hfmax + 1 );
|
||||||
LandGeom = d.CreateHeightfield(space, HeightmapData, 1);
|
LandGeom = d.CreateHeightfield(space, HeightmapData, 1);
|
||||||
if (LandGeom != IntPtr.Zero)
|
if (LandGeom != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
|
@ -3047,6 +3045,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
|
d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
|
||||||
d.GeomSetRotation(WaterGeom, ref R);
|
d.GeomSetRotation(WaterGeom, ref R);
|
||||||
d.GeomSetPosition(WaterGeom, 128, 128, 0);
|
d.GeomSetPosition(WaterGeom, 128, 128, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue