All pastes #499412 Raw Edit

odefix

public text v1 · immutable
·published 2007-05-21 01:32 UTC
rendered paste body
Index: OpenSim.sln
===================================================================
--- OpenSim.sln	(revision 762)
+++ OpenSim.sln	(working copy)
@@ -1,5 +1,5 @@
 Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
+# Visual C# Express 2005
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Terrain.BasicTerrain", "OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj", "{2270B8FE-0000-0000-0000-000000000000}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Storage.LocalStorageBerkeleyDB", "OpenSim.Storage\LocalStorageBerkeleyDB\OpenSim.Storage.LocalStorageBerkeleyDB.csproj", "{EE9E5D96-0000-0000-0000-000000000000}"
Index: OpenSim.Physics/OdePlugin/OdePlugin.cs
===================================================================
--- OpenSim.Physics/OdePlugin/OdePlugin.cs	(revision 762)
+++ OpenSim.Physics/OdePlugin/OdePlugin.cs	(working copy)
@@ -182,7 +182,11 @@
         {
             for (int i = 0; i < 65536; i++)
             {
-                this._heightmap[i] = (double)heightMap[i];
+                // this._heightmap[i] = (double)heightMap[i];
+                // dbm (danx0r) -- heightmap x,y must be swapped for Ode (should fix ODE, but for now...)
+                int x = i & 0xff;
+                int y = i >> 8;
+                this._heightmap[i] = (double)heightMap[x * 256 + y];
             }
             IntPtr HeightmapData = d.GeomHeightfieldDataCreate();
             d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 256, 256, 256, 256, 1.0f, 0.0f, 2.0f, 0);
@@ -335,7 +339,7 @@
             d.Vector3 vec = d.BodyGetPosition(BoundingCapsule);
             this._position.X = vec.X;
             this._position.Y = vec.Y;
-            this._position.Z = vec.Z;
+            this._position.Z = vec.Z+1.0f;
         }
     }