guys nid help... i messing up with my angle for my flight simulator...heres my code please help me...
// Dark GDK - The Game Creators - www.thegamecreators.com
// the wizard has created a very simple project that uses Dark GDK
// it contains the basic code for a GDK application
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
// 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 ( 120 );
// Maximize Window
//dbMaximizeWindow();
//dbSetWindowOff();
// we are going to use a skybox in this demo and it will
// be scaled up to quite a large size, this will initially
// result in it being outside of the cameras default range
// therefore it will not be drawn, to adjust this we simply
// increase the cameras range
dbSetCameraRange ( 1.0f, 50000.0f );
// two textures are going to be used for the terrain, the first
// will be the diffuse part and the second will be used to
// create extra detail on the terrain
dbLoadImage ( "texture.jpg", 1 );
dbLoadImage ( "detail.jpg", 2 );
// the first step in creating a terrain is to call the
// function dbSetupTerrain, this will perform some internal
// work that allows us to get started
dbSetupTerrain ( );
// now we can get started on making the terrain object
dbMakeObjectTerrain ( 1 );
// here we pass in a heightmap that will be used to create the terrain
dbSetTerrainHeightMap ( 1, "practice.jpg" );
// now we set the scale, this will have the effect of making
// the terrain large on the X and Z axis but quite small on the Y
dbSetTerrainScale ( 1, 3.0f, 0.6f, 3.0f );
// adjust the lighting for the terrain, this function takes the ID
// number, then a direction for the light, then 3 colours for the light
// and finally the scale, by using this function we can adjust the
// overall colour of the terrain
dbSetTerrainLight ( 1, 1.0f, -0.25f, 0.0f, 1.0f, 1.0f, 0.78f, 0.5f );
// in this call we're telling the terrain that its diffuse texture
// will come from image 1 and its detail texture will come from
// image 2
dbSetTerrainTexture ( 1, 1, 2 );
// once we have set all properties of the terrain we can build it,
// at this point it gets created and added into your world
dbBuildTerrain ( 1 );
// with the terrain in place we can now load a skybox
dbLoadObject ( "skybox2.x", 2 );
// we dont need it to respond to light so switch light off
dbSetObjectLight ( 2, 0 );
// make the skybox much larger
dbScaleObject ( 2, 30000, 30000, 30000 );
// position the camera
dbPositionCamera ( 385, 200, 100 );
// adjust texture properties of sky box
dbSetObjectTexture ( 2, 3, 1 );
float fCameraAngleX = 0.0f;
float fCameraAngleY = 0.0f;
// create a sphere
dbMakeObjectCube(5,1);
// reposition the sphere so it follow the camera
dbPositionObject(5,385,200,200);
dbScaleObject(5,100,100,100);
// our main loop
while ( LoopGDK ( ) )
{
// let the user move the camera around with the arrow keys
// dbControlCameraUsingArrowKeys ( 0, 2.0f, 2.0f );
// find the ground height of the terrain
float fHeight = dbGetTerrainGroundHeight ( 1, dbCameraPositionX ( ), dbCameraPositionZ ( ) );
// create a rotation axis based on Key Press
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbUpKey ( ) * 0.4f );
fCameraAngleX = dbWrapValue ( fCameraAngleX - dbDownKey ( ) * 0.4f);
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbRightKey ( ) * 0.4f );
fCameraAngleY = dbWrapValue ( fCameraAngleY - dbLeftKey ( ) * 0.4f );
// rotate camera
dbXRotateCamera ( fCameraAngleX );
dbYRotateCamera ( fCameraAngleY );
// W state
if (dbKeyState(17))
{
dbRotateObject(5,(fCameraAngleX),(fCameraAngleY),dbObjectPositionZ(5));
dbPositionObject( 5, dbNewXValue( dbObjectPositionX( 5 ), dbObjectAngleY( 5 ), .4 ), dbNewYValue( dbObjectPositionY( 5 ), dbObjectAngleY( 5 ), .4), dbNewZValue( dbObjectPositionZ( 5 ), dbObjectAngleY( 5 ), .4 ));
}
// CAMERA CODE
//dbSetCameraToFollow( dbObjectPositionX( 5 ), dbObjectPositionY( 5 ), dbObjectPositionZ( 5 ), dbObjectAngleY( 5 ), 0, 8, 100, 0 );
//dbPointCamera(dbObjectPositionX( 5 ), dbObjectPositionY( 5 ), dbObjectPositionZ( 5 ));
// reposition the camera so it is directly above the ground
dbPositionCamera ( dbObjectPositionX (5),dbObjectPositionY (5), dbObjectPositionZ (5) );
// update the terrain
dbUpdateTerrain ( );
// update the screen
dbSync ( );
}
// return back to windows
return;
}
masters im badly needing for your help...