diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 9a1645d..533464e 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -297,6 +297,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
297 | // Create the world and the first space | 297 | // Create the world and the first space |
298 | world = d.WorldCreate(); | 298 | world = d.WorldCreate(); |
299 | space = d.HashSpaceCreate(IntPtr.Zero); | 299 | space = d.HashSpaceCreate(IntPtr.Zero); |
300 | |||
300 | 301 | ||
301 | contactgroup = d.JointGroupCreate(0); | 302 | contactgroup = d.JointGroupCreate(0); |
302 | //contactgroup | 303 | //contactgroup |
@@ -484,6 +485,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
484 | d.WorldSetQuickStepNumIterations(world, m_physicsiterations); | 485 | d.WorldSetQuickStepNumIterations(world, m_physicsiterations); |
485 | //d.WorldSetContactMaxCorrectingVel(world, 1000.0f); | 486 | //d.WorldSetContactMaxCorrectingVel(world, 1000.0f); |
486 | 487 | ||
488 | |||
489 | |||
487 | for (int i = 0; i < staticPrimspace.GetLength(0); i++) | 490 | for (int i = 0; i < staticPrimspace.GetLength(0); i++) |
488 | { | 491 | { |
489 | for (int j = 0; j < staticPrimspace.GetLength(1); j++) | 492 | for (int j = 0; j < staticPrimspace.GetLength(1); j++) |
@@ -2900,15 +2903,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2900 | m_log.Warn("[PHYSICS]: Non finite heightfield element detected. Setting it to 0"); | 2903 | m_log.Warn("[PHYSICS]: Non finite heightfield element detected. Setting it to 0"); |
2901 | resultarr2[y, x] = 0; | 2904 | resultarr2[y, x] = 0; |
2902 | } | 2905 | } |
2903 | 2906 | returnarr[i] = resultarr2[y, x]; | |
2904 | if (resultarr2[y, x] <= 0) | ||
2905 | { | ||
2906 | returnarr[i] = 0.0000001f; | ||
2907 | |||
2908 | } | ||
2909 | else | ||
2910 | returnarr[i] = resultarr2[y, x]; | ||
2911 | |||
2912 | i++; | 2907 | i++; |
2913 | } | 2908 | } |
2914 | } | 2909 | } |
@@ -2934,7 +2929,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2934 | 2929 | ||
2935 | //Double resolution | 2930 | //Double resolution |
2936 | heightMap = ResizeTerrain512Interpolation(heightMap); | 2931 | heightMap = ResizeTerrain512Interpolation(heightMap); |
2937 | 2932 | float hfmin = 2000; | |
2933 | float hfmax = -2000; | ||
2938 | for (int x = 0; x < heightmapWidthSamples; x++) | 2934 | for (int x = 0; x < heightmapWidthSamples; x++) |
2939 | { | 2935 | { |
2940 | for (int y = 0; y < heightmapHeightSamples; y++) | 2936 | for (int y = 0; y < heightmapHeightSamples; y++) |
@@ -2944,6 +2940,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2944 | 2940 | ||
2945 | float val = heightMap[yy*512 + xx]; | 2941 | float val = heightMap[yy*512 + xx]; |
2946 | _heightmap[x*heightmapHeightSamples + y] = val; | 2942 | _heightmap[x*heightmapHeightSamples + y] = val; |
2943 | hfmin = (val < hfmin) ? val : hfmin; | ||
2944 | hfmax = (val > hfmax) ? val : hfmax; | ||
2947 | } | 2945 | } |
2948 | } | 2946 | } |
2949 | 2947 | ||
@@ -2957,7 +2955,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2957 | d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0, heightmapWidth, heightmapHeight, | 2955 | d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0, heightmapWidth, heightmapHeight, |
2958 | (int) heightmapWidthSamples, (int) heightmapHeightSamples, scale, | 2956 | (int) heightmapWidthSamples, (int) heightmapHeightSamples, scale, |
2959 | offset, thickness, wrap); | 2957 | offset, thickness, wrap); |
2960 | d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight); | 2958 | d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1 , hfmax + 1 ); |
2961 | LandGeom = d.CreateHeightfield(space, HeightmapData, 1); | 2959 | LandGeom = d.CreateHeightfield(space, HeightmapData, 1); |
2962 | if (LandGeom != IntPtr.Zero) | 2960 | if (LandGeom != IntPtr.Zero) |
2963 | { | 2961 | { |
@@ -3047,6 +3045,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3047 | d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); | 3045 | d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); |
3048 | d.GeomSetRotation(WaterGeom, ref R); | 3046 | d.GeomSetRotation(WaterGeom, ref R); |
3049 | d.GeomSetPosition(WaterGeom, 128, 128, 0); | 3047 | d.GeomSetPosition(WaterGeom, 128, 128, 0); |
3048 | |||
3050 | } | 3049 | } |
3051 | 3050 | ||
3052 | } | 3051 | } |