what am i doing wrong==??
i cant get collision
#include "DarkGDK.h"
//othere
float fHeight = dbGetTerrainGroundHeight(1,dbCameraPositionX(),dbCameraPositionZ());
//player
float PlayerSpeed1 = 0.3f;
float PlayerSpeed2 = 0.2f;
float PlayerSpeed3 = 0.15;
//voids
void Controls ( void );
void Map(void);
void LoadFilles(void);
void Physics(void);
void DarkGDK ( void )
{
//setup
dbSyncOn();
dbBackdropOff();
dbSetCameraRange ( 0.5f, 30000 );
dbMaximizeWindow();
dbSetWindowTitle("Dgame");
dbHideMouse();
dbAutoCamOn();
LoadFilles();
Map();
// set starting camera position
dbPositionCamera ( 0, fHeight+3.0f, 0 );
//Collision Setup
int colobj = 0, x = 0, y = 0, z = 0, ox = 0, oy = 0, oz = 0;
dbMakeObjectCube(999, 4);
while ( LoopGDK ( ) )
{
if ( dbEscapeKey ( ) )
return;
////////////////////////////////////////////////////////////////////////////////////
//collision
dbPositionObject(999, dbCameraPositionX(0), dbCameraPositionY(0), dbCameraPositionZ(0));
dbHideObject(999);
x = dbObjectPositionX(999);
y = dbObjectPositionY(999);
z = dbObjectPositionZ(999);
ox = x;
oy = y;
oz = z;
dbPositionObject(999, x, y, z);
colobj = dbObjectCollision(999, 5);
if(colobj == 2)
{
dbPositionObject(999, ox, oy, oz);
}
//////////////////////////////////////////////////////////////////
Physics();
Controls();
dbUpdateTerrain ();
dbSync ();
}
}
void Controls ( void )
{
/////////////////////////////////////////////////////////////////////////////////
//MOVE KEYS
if (dbKeyState( 17 ) ==1 )
{
dbMoveCamera ( 0 , PlayerSpeed1 );
}
if ( dbKeyState( 32 ) == 1 )
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) + 90 );
dbMoveCamera ( 0 , PlayerSpeed3);
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) -90 );
}
if ( dbKeyState(31)==1 )
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) -180 );
dbMoveCamera ( 0 , PlayerSpeed2 );
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) +180 );
}
if (dbKeyState(30)==1)
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) -90 );
dbMoveCamera ( 0 , PlayerSpeed3 );
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) +90 );
}
///////////////////////////////////////////////////////////////////////////////////
}
}
void Map(void)
{
//terrain
dbSetupTerrain ();
dbMakeObjectTerrain (1 );
dbSetTerrainHeightMap (1, "Media\\Terrain\\Traning\\H-map.bmp" );
dbSetTerrainScale (1, 3, 0.6f, 3 );
dbSetTerrainSplit (1, 16 );
dbSetTerrainTiling (1, 4 );
dbSetTerrainLight (1, 1.0f, -0.25f, 0.0f, 1, 1, 0.78f, 0.5f );
dbSetTerrainTexture (1, 1, 2 );
dbBuildTerrain (1);
//skybox
dbLoadObject( "Media\\Skybox\\skybox2.x", 200 );
dbSetObjectLight ( 200, 0 );
dbSetObjectTexture ( 200, 3, 1 );
dbPositionObject ( 200, 1000, 2000, 4000 );
dbScaleObject ( 200, 22000, 22000, 22000 );
//MAP OBJECTS
//terrain
dbPositionObject(1, 0, 0, 0);
//helipad
dbPositionObject(2, 28, 81.7, 190);
dbScaleObject(2, 200, 200, 200);
dbRotateObject(2, 90, 90, 0);
//Crates
//1
dbPositionObject(3, 60, 78.5, 174);
//2
dbPositionObject(4, 64, 78.5, 174);
//3
dbPositionObject(5, 62.25, 81.57, 174);
dbRotateObject(5, 0, 20, 0);
//bradley tank
dbPositionObject(6, 35, 77.5, 130);
dbRotateObject(6, 90, 145, 0);
dbScaleObject(6, 300, 300, 300);
//Solider
dbPositionObject(7, 8, fHeight, 8);
}
void LoadFilles( void )
{
dbPrint("Pleas Wait Loading...");
dbSync();
dbSync();
//images
//terrain
dbLoadImage("Media\\Terrain\\texture.jpg", 1);
dbLoadImage("Media\\Terrain\\detail.jpg", 2);
//meshes
//helipad
dbLoadObject("Media\\Meshes\\helipad\\helipad.x", 2);
//Crate
dbLoadObject("Media\\Meshes\\Crate\\crate.x", 3);
dbLoadObject("Media\\Meshes\\Crate\\crate.x", 4);
dbLoadObject("Media\\Meshes\\Crate\\crate.x", 5);
//Bradle tank
dbLoadObject("Media\\Meshes\\Bradle\\bradley.x", 6);
//asault troper
dbLoadObject("Media\\Meshes\\crywar\\Assault Trooper.x", 7);
//sounds
}
void Physics(void)
{
float fHeight = dbGetTerrainGroundHeight(1,dbCameraPositionX(),dbCameraPositionZ());
}
Game.Love