Hi,
with
dbLoadObject ( "Textures/warrior.X", 1003 );
dbPositionObject ( 1003 , 2400, 0, 1000 );
dbScaleObject ( 1003 , 1800, 1800, 1800 );
dbSetObjectLight ( 1003, 0 );
dbSetObjectCollisionToPolygons ( 1003 );
dbLoopObject ( 1003);
dbSetObjectSpeed ( 1003, 50 );
I'm loading my Object. I can see it, the walking animation works and it has collision etc.
Now I want it (the knight) to walk on my heightmap.
Then the knight moves, but disappears when the heightmap gets higher.
So I thought, that I could take the same code I use for the camera:
// find the ground height of the terrain
float fHeight = dbGetTerrainGroundHeight ( 1, dbCameraPositionX ( ), dbCameraPositionZ ( ) );
// reposition the camera so it is directly above the ground
dbPositionCamera ( dbCameraPositionX ( 0 ), fHeight + 50.0f, dbCameraPositionZ ( 0 ) );
For the camera this code is working correctly.
But when I change it to use it for my Object,
float fHeight_Objects = dbGetTerrainGroundHeight ( 1, dbObjectPositionX ( 1003 ), dbObjectPositionZ ( 1003 ) );
dbPositionObject( 1003, dbObjectPositionX ( 1003 ), fHeight_Objects, dbObjectPositionX ( 1003 ) );
dbMoveObject(1003, 1);
The Object just disappears (or it gets somewhere, where I can't find it).
Where is the mistake?
regards
http://www.Computer-Masters.de