how do I add velocity? not really all that familiar with the commands. here is a code i have so far, that i got from this thread(http://forum.thegamecreators.com/?m=forum_view&t=89539&b=1)
// Dark GDK - The Game Creators - www.thegamecreators.com
// include the Dark GDK header
#include "DarkGDK.h"
#include "SC_Collision.h"
void DarkGDK ( void )
{
// entry point for the application
// check collission object 9 against 8
int isCollision = SC_objectCollision ( 9, 8 );
// switch on sync rate and set to a maximum of 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
SC_Start();
// 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, 30000.0f );
float Z = 500.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 ( "eee.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, "yes.bmp" );
// 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, 23, 100 );
// adjust texture properties of sky box
dbSetObjectTexture ( 2, 3, 1 );
// make a box to simulate sonar
dbMakeObjectBox (9, 1, 1, 1);
//position box in front of car
dbPositionObject (9, 0, 1.5, 92);
//Hide box
//dbHideObject (9);
SC_SetupObject(9, 0, 0);
//Make a large box in front of car to test collision
dbMakeObjectBox (8, 20, 20, 20);
dbPositionObject (8, 0, 0, 0);
SC_SetupObject (8, 0, 0);
//loading a car
dbLoadObject ("H-Stock Car Blank-Move.x", 10);
dbPositionObject (10, 0, 0, 100);
dbScaleObject (10, 300, 300, 300);
// now onto our main loop
while ( LoopGDK ( ) )
{ x = dbObjectPositionX(9);
y = dbObjectPositionY(9);
z = dbObjectPositionZ(9);
// 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 ( ) );
// reposition the camera so it is directly above the ground
dbPositionCamera ( dbCameraPositionX ( ), fHeight + 10.0f, dbCameraPositionZ ( ) );
if ( isCollision == 1 ) // collision is happening, else 0 = no collision
{
dbPositionObject (9, oldx, oldy, oldz);
}
//Z = Z - 1.0f;
//dbPositionObject (10, 0, 0, Z);
//dbPositionObject (9, 0, 1.5, Z-8);
oldx = x;
oldy = y;
oldz = z;
// update the terrain
dbUpdateTerrain ( );
// update the screen
dbSync ( );
}
}