[ODE] new ODE 0.8 heightfield seems working wrong
pegasi at inbox.ru
Wed Jan 31 09:25:03 MST 2007
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
mHeightMapSampleData, 0, // based on this instance of data, no duplication
worldCorner2-worldCorner1, // total x dimension
worldCorner2-worldCorner1, // 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, worldCorner2 );
// 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:
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.
posHeightMap= worldCorner2; // bottom of world
dGeomSetPosition( mHeightFieldGeom, posHeightMap, posHeightMap, posHeightMap );
So why mu truck begun to fall in a heightfield?
More information about the ODE