I need help with my terrain positioning. I have made the tutorial that comes with dark GDK on terrain but how can i make it so my character starts on the terrain and not in the 'floating abyss'. This also applies to other objects because i tried positioning the bezerker model but it didnt end up there. My code so far for the fps is:
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
int fCameraAngleX; //camera x variable
int fCameraAngleY; //camera y variable
// the main entry point for the application is this function
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetCameraRange( 1.0f, 30000.0f );
dbLoadImage ("texture.jpg", 1 );
dbLoadImage ("detail.jpg", 2 );
dbSetupTerrain( );
dbMakeObjectTerrain( 1 );
dbSetTerrainHeightMap ( 1, "map.bmp" );
dbSetTerrainScale ( 1, 7.0f, 0.8f, 7.0f );
dbSetTerrainLight ( 1, 1.0f, -0.25f, 0.0f, 1.0f, 1.0f, 0.78f, 0.5f );
dbSetTerrainTexture ( 1, 1, 2 );
dbBuildTerrain ( 1 );
dbPositionObject( 1, 0, 0, 0);
dbLoadObject("skybox2.x", 2 );
dbSetObjectLight ( 2, 0 );
dbSetObjectTexture ( 2, 3, 2);
dbScaleObject( 2, 33000, 33000, 33000);
dbPositionCamera ( 385, 23, 100 );
dbLoadObject("Atomiser.x",10);
dbDisableObjectZDepth(10);
dbRotateObject(10,-90,0,0);
dbPositionObject(10,10,-15,20);
dbLockObjectOn(10); //no locking to screen
dbFixObjectPivot(10);//This just fixes rotation issues
dbLoadImage("gunfire1.png",100,0);
dbMakeObjectBox( 11, 4 , 4, 0 );//First make a box
dbTextureObject( 11 , 100 );
dbFadeObject( 11, 8000 );
dbSetObjectTransparency( 11 , 1 );
dbHideObject( 11 );//Hide it when not in use
dbSetObjectCollisionOff( 11 );//No need for collision
//This basically handles the positioning of the muzzleflash
dbMoveObjectRight( 11 , 1.85f);
dbMoveObject( 11 , 8 );
dbMoveObjectDown( 11 , 1.3f);
dbLockObjectOn( 11 );//Always lock it on
dbLoadSound("Gun 8.wav",21);//Load a gun sound, id is 21
dbSetSoundSpeed(21,88000);
// our main loop
while ( LoopGDK ( ) )
{
if (dbUpKey())
{
dbMoveCamera(1.5);
}
if (dbDownKey())
{
dbMoveCamera(-1.5);
}
//This handles starfing for us
if (dbLeftKey())
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) - 90 );
dbMoveCamera(1.5);
}
if (dbRightKey())
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) + 90 );
dbMoveCamera(1.5);
}
//First you make the camera formula here
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbMouseMoveY ( ) * 0.2f );
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbMouseMoveX ( ) * 0.2f );
// rotate camera in our game
dbXRotateCamera ( fCameraAngleX );
dbYRotateCamera ( fCameraAngleY );
float fHeight = dbGetTerrainGroundHeight( 1, dbCameraPositionX( ), dbCameraPositionZ());
dbPositionCamera(dbCameraPositionX( ), fHeight + 10.0f, dbCameraPositionZ());
//Crosshair image
dbLoadImage("crosshair.png",1000);
dbPasteImage ( 1000 , ( dbScreenWidth( ) / 2 ) - 16 , ( dbScreenHeight( ) / 2 ) - 16 , 1 );
if ( dbMouseClick() == 1)//If left mouse button is pressed
{
dbPlaySound(21);//Play gun sound
dbLoopSound(21,0,10000,0);//Loop it again and again
dbShowObject(11);//show muzzleflash
dbRollObjectLeft ( 11 , (float)(rand() % 360) );
}
else//otherwise
{
dbPauseSound(21);//pause gun sound
dbHideObject(11);//hide muzzleflash
}
dbHideMouse ( ); // Hide Mouse
dbPositionMouse ( dbScreenWidth()/2 , dbScreenHeight()/2 ); // Keep mouse in middle.
// update the screen
dbSync ( );//used to update
}
// return back to windows when done with program
return;
}