* Applying danx0r's ODE patch

* ZOMG r1000!
afrisby
Adam Frisby 2007-06-13 01:30:39 +00:00
parent de7dafa3b9
commit ba96621625
1 changed files with 6 additions and 2 deletions

View File

@ -182,7 +182,11 @@ namespace OpenSim.Physics.OdePlugin
{ {
for (int i = 0; i < 65536; i++) 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(); IntPtr HeightmapData = d.GeomHeightfieldDataCreate();
d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 256, 256, 256, 256, 1.0f, 0.0f, 2.0f, 0); d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 256, 256, 256, 256, 1.0f, 0.0f, 2.0f, 0);
@ -335,7 +339,7 @@ namespace OpenSim.Physics.OdePlugin
d.Vector3 vec = d.BodyGetPosition(BoundingCapsule); d.Vector3 vec = d.BodyGetPosition(BoundingCapsule);
this._position.X = vec.X; this._position.X = vec.X;
this._position.Y = vec.Y; this._position.Y = vec.Y;
this._position.Z = vec.Z; this._position.Z = vec.Z+1.0f;
} }
} }