Is someone able to glance over my code and let me know what is stopping me from moving? It may be completely obvious but I just cant find it. I load the terrain, gun, enemy.. but now im stuck, I wasnt before. :/ The code is:
#include "DarkGDK.h"
// the main entry point for the application is this function
int fCameraAngleX;
int fCameraAngleY;
void mouse(void);
void DarkGDK ( void )
{
dbAutoCamOff();
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetCameraRange ( 1.0f, 30000.0f );
// Load my gun, terrain and enemy
dbLoadObject("Atomiser.x",10);
dbLoadObject("Bezerker.x",20);
dbLoadImage ( "texture.jpg", 1 );
dbLoadImage ( "detail.jpg", 2 );
//set collision on.
dbAutomaticCameraCollision(0,2,1);
dbPositionObject(2,50,10,100);
dbSetObjectCollisionToBoxes ( 2 );
dbPositionObject(20,100,0,150);
dbRotateObject(20,-90,180,0);
dbRotateObject(10,-90,0,0);
dbPositionObject(10,10,-15,20);
dbLockObjectOn(10);
dbSetObjectCollisionToPolygons ( 20 );
// call function to begin terrain creation
dbSetupTerrain ( );
// create the terrain object
dbMakeObjectTerrain ( 1 );
// create height
dbSetTerrainHeightMap ( 1, "map.bmp" );
// Create a scale for the terrain, large x and z to create width, low on the y
dbSetTerrainScale ( 1, 3.0f, 0.6f, 3.0f );
// adjust colour of the terrain, direction of light
dbSetTerrainLight ( 1, 1.0f, -0.25f, 0.0f, 1.0f, 1.0f, 0.78f, 0.5f );
// image 1 = detail texture image, image 2 = diffuse image
dbSetTerrainTexture ( 1, 1, 2 );
// Build my created terrain.
dbBuildTerrain ( 1 );
// Load the skybox perimeters
dbLoadObject ( "skybox2.x", 2 );
// Skybox response to light = false
dbSetObjectLight ( 2, 0 );
// Set the skybox larger than the terrain.
dbScaleObject ( 2, 30000, 30000, 30000 );
// position the camera***
dbPositionCamera ( 385, 23, 100 );
// adjust texture properties of my skybox
dbSetObjectTexture ( 2, 3, 1 );
// my main loop
while ( LoopGDK ( ) )
{
mouse( );
dbMakeMatrix(4,100,100,10,10);
// 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 ( ), fHeight + 10.0f, dbCameraPositionZ ( ) );
// update the terrain
dbUpdateTerrain ( );
// update the screen
dbSync ( );
}
// return back to windows
return;
}
void mouse(void)
{
// Set the movement for the up cursor key
if (dbUpKey())
{
dbMoveCamera(2);
}
// Set the movement for the down cursor key
if (dbDownKey())
{
dbMoveCamera(-2);
}
// Set the movement for the left and right cursor keys
// No rotation on the camera, but move its position up or down
// in the perpendicular direction.
if (dbLeftKey())
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) - 90 );
dbMoveCamera(2);
}
if (dbRightKey())
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) + 90 );
dbMoveCamera(2);
}
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbMouseMoveY ( ) * 0.2f );
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbMouseMoveX ( ) * 0.2f );
// rotate camera
dbXRotateCamera ( fCameraAngleX );
dbYRotateCamera ( fCameraAngleY );
}