aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authordan miller2007-10-29 06:15:06 +0000
committerdan miller2007-10-29 06:15:06 +0000
commitc29f8b3873888df9505965399fe0639f13fe8db0 (patch)
treea2aa95b4aae557d773e4d3a904dccaede836cf47 /OpenSim/Region/Physics
parentAdded preliminary support for sitting on prims (diff)
downloadopensim-SC_OLD-c29f8b3873888df9505965399fe0639f13fe8db0.zip
opensim-SC_OLD-c29f8b3873888df9505965399fe0639f13fe8db0.tar.gz
opensim-SC_OLD-c29f8b3873888df9505965399fe0639f13fe8db0.tar.bz2
opensim-SC_OLD-c29f8b3873888df9505965399fe0639f13fe8db0.tar.xz
should help with ODE bounce on region cross
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs26
1 files changed, 18 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index c707a87..1cf4710 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -123,7 +123,7 @@ namespace OpenSim.Region.Physics.OdePlugin
123 d.WorldSetContactMaxCorrectingVel(world, 1000.0f); 123 d.WorldSetContactMaxCorrectingVel(world, 1000.0f);
124 } 124 }
125 125
126 _heightmap = new double[65536]; 126 _heightmap = new double[258*258];
127 } 127 }
128 128
129 // This function blatantly ripped off from BoxStack.cs 129 // This function blatantly ripped off from BoxStack.cs
@@ -393,13 +393,23 @@ namespace OpenSim.Region.Physics.OdePlugin
393 393
394 public override void SetTerrain(float[] heightMap) 394 public override void SetTerrain(float[] heightMap)
395 { 395 {
396 for (int i = 0; i < 65536; i++) 396 // this._heightmap[i] = (double)heightMap[i];
397 // dbm (danx0r) -- heightmap x,y must be swapped for Ode (should fix ODE, but for now...)
398 // also, creating a buffer zone of one extra sample all around
399 for (int x = 0; x < 258; x++)
397 { 400 {
398 // this._heightmap[i] = (double)heightMap[i]; 401 for (int y = 0; y < 258; y++)
399 // dbm (danx0r) -- heightmap x,y must be swapped for Ode (should fix ODE, but for now...) 402 {
400 int x = i & 0xff; 403 int xx = x-1;
401 int y = i >> 8; 404 if (xx < 0) xx = 0;
402 _heightmap[i] = (double)heightMap[x * 256 + y]; 405 if (xx > 255) xx = 255;
406 int yy = y-1;
407 if (yy < 0) yy = 0;
408 if (yy > 255) yy = 255;
409
410 double val = (double)heightMap[yy * 256 + xx];
411 _heightmap[x * 258 + y] = val;
412 }
403 } 413 }
404 414
405 lock (OdeLock) 415 lock (OdeLock)
@@ -409,7 +419,7 @@ namespace OpenSim.Region.Physics.OdePlugin
409 d.SpaceRemove(space, LandGeom); 419 d.SpaceRemove(space, LandGeom);
410 } 420 }
411 IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); 421 IntPtr HeightmapData = d.GeomHeightfieldDataCreate();
412 d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 256, 256, 256, 256, 1.0f, 0.0f, 2.0f, 1); 422 d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 258, 258, 258, 258, 1.0f, 0.0f, 2.0f, 0);
413 d.GeomHeightfieldDataSetBounds(HeightmapData, 256, 256); 423 d.GeomHeightfieldDataSetBounds(HeightmapData, 256, 256);
414 LandGeom = d.CreateHeightfield(space, HeightmapData, 1); 424 LandGeom = d.CreateHeightfield(space, HeightmapData, 1);
415 this.geom_name_map[LandGeom]="Terrain"; 425 this.geom_name_map[LandGeom]="Terrain";