Hey there,
I have just started using Dark GDK and Visual C++,
and though I think i have a fairly basic understanding of the commands i have used so far, (working on a test level, to learn more about how to use the commands)
I have gotten this far;
#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 ( 60 );
// switch to the media directory, load our world
// and turn lighting off
SetCurrentDirectory ( "media" );
dbLoadObject ( "universe.dbo", 1 );
dbSetObjectLight ( 1, 0 );
dbScaleObject ( 1, 250, 250, 250 );
// load a model for our sky
dbLoadObject ( "skybox2.x", 2 );
dbSetObjectLight ( 2, 0 );
dbSetObjectTexture ( 2, 3, 2 );
dbScaleObject ( 2, 5000, 5000, 5000 );
// position the camera
dbPositionCamera ( 434, 42, -517 );
// camera variables
float fCameraAngleX = 0.0f;
float fCameraAngleY = 0.0f;
// our main loop
while ( LoopGDK ( ) )
{
// move the camera using the arrow keys
dbControlCameraUsingArrowKeys ( 0, 8.0f, 0.3f );
float fHeight = dbGetTerrainGroundHeight ( 1, dbCameraPositionX ( ),
dbCameraPositionZ ( ) );
dbPositionCamera ( dbCameraPositionX ( ), fHeight + 1400.0f, // This is above the ground of my imported FPSC Map
dbCameraPositionZ ( ) ); // Set in a height as if you see thru the eyes of
dbUpdateTerrain ( ); // the player character
// rotate camera
dbXRotateCamera ( fCameraAngleX );
dbYRotateCamera ( fCameraAngleY );
// create a rotation axis based on mouse movement
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbMouseMoveY ( ) * 0.4f );
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbMouseMoveX ( ) * 0.4f );
// update the screen
dbSync ( );
}
// return back to windows
return;
}
But what i want to do is the following;
Prevent the "player" from tilting the camera over/under itself.
I have searched the forums, but I just can't understand how to do this, So help would be appreciated. (bear in mind that I have very little experience with Darkbasic or c++)
I also can't figure out how to make the camera collide with the map (a dbo) , and I have downloaded the Sparkys collision stuff, but I really can't see how I am to use it. SO here help would also be appreciated greatly.
I hope someone here is able to help me with any of these problems
Thanks,
Essal