[ODE] new ODE 0.8 heightfield seems working wrong
Dmitry Medvedev
pegasi at inbox.ru
Wed Jan 31 09:25:03 MST 2007
Hello, everybody.
Just change ODE from 0.7 to 0.8-rc1.
I have a scrolling screen in XoY plane with a moving truck and use dHeightfield to represent a landscape.
Truck's wheels are falling under the heightfiled now... but I didn't change anything in my code.
In a new heightfield source code all changes are only in private functions and data, all interface functions like dGeomHeightfieldDataBuildSingle() have the same code like in 0.7. So what could happened?
(If to build ODE 0.8 and copy to its sources heightfield.cpp, heightfield.h from 0.7 aeverything works)
Here is a part of a creating heightfield code:
mHeightMapDataID = dGeomHeightfieldDataCreate();
// configure a heightfield
dGeomHeightfieldDataBuildSingle(mHeightMapDataID,
mHeightMapSampleData, 0, // based on this instance of data, no duplication
worldCorner2[0]-worldCorner1[0], // total x dimension
worldCorner2[2]-worldCorner1[2], // total z dimensions
mHeightMapSampleCount, 2, // cell count on x,z
REAL( 1.0 ), REAL( 0.0 ), // scale, offset
REAL( 0.1 ), 0); // // thickness, wrap
// set finite AABB
dGeomHeightfieldDataSetBounds( mHeightMapDataID, worldCorner1[1], worldCorner2[1] );
// the height field is movable, y is the height, we position it around z=0 axis
mHeightFieldGeom = dCreateHeightfield( mGroundSpace, mHeightMapDataID, 1);
My system has Y axis increasing from top to bottom, so rotate heightfield geometry 180 degrees about Z axis:
dMatrix3 R;
dRSetIdentity( R );
dRFromAxisAndAngle( R, 0, 0, 1, DEGTORAD * 180 );
dGeomSetRotation( mHeightFieldGeom, R );
Place geometry in the center of world's X axis and at the bottom of it.
dVector3 posHeightMap;
posHeightMap[0]= (worldCorner1[0]+worldCorner2[0])/2.0f;
posHeightMap[1]= worldCorner2[1]; // bottom of world
posHeightMap[2]= 0.0f;
dGeomSetPosition( mHeightFieldGeom, posHeightMap[0], posHeightMap[1], posHeightMap[2] );
So why mu truck begun to fall in a heightfield?
More information about the ODE
mailing list