OK so Ive got this nice plan to have the controls as the following
up - forward
back - back up
right/left - turn and strafe simultaniously
I fixed the lurching, but now I cant face any new angles, and I cant rotate the object. I was hoping for a wheel effect, but thats really hard to make... Cant anyone help me get it to rotate the angle its facing, and to roll forward, backward, and to the sides as it moves. One problem is at 180 degrees forward becomes backward... Ive seen games with rolling spheres before, maybe I can rotate the texture on it..?
Ive tried to get it to rotate using the X, Y, and Z RotateObject set, as well as roll, pitch, and turn set. XYZ dont relate to the object and dont work if i try to move it aswell, and the roll-pitch-turn dont stop, ever. The camera stays facing the same angle too! Can someone explain how to use these a little better for me?
PS one more thing, even when i dont have the chase came active me setting my cameras starting position anywhere doesnt work at all. its like its not even coded in...
#include "DarkGDK.h"
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
// setting up terrain
dbSetupTerrain ( );
dbMakeObjectTerrain ( 2 );
dbSetTerrainHeightMap ( 2, "Height.bmp" );
dbSetTerrainScale ( 2, 6.0f, 1.2f, 6.0f );
// colouring terrain
dbLoadImage ( "Terrain.png", 1 );
dbLoadImage ( "grass08.bmp", 2 );
dbSetTerrainTexture ( 2, 1, 2 );
dbScaleObjectTexture ( 2, 2.0, 2.0 );
//dbSetTerrainLight ( 2, 1.0f, -0.25f, 0.0f, 1.0f, 1.0f, 0.78f, 0.5f );
// creating terrain in game
dbBuildTerrain ( 2 );
// skybox
dbSetCameraRange ( 1.0f, 30000.0f );
dbLoadObject ( "skybox2.x", 3 );
dbSetObjectLight ( 3, 0 );
dbScaleObject ( 3, 30000, 30000, 30000 );
// camera start
dbPositionCamera ( 50000, 50000, 50000 );
dbMakeObjectSphere ( 1, 10, 10, 10 );
dbTextureObject ( 1, 2 );
dbPositionObject ( 1, 100, 100, 100 );
// our main loop
while ( LoopGDK ( ) )
{
if ( dbUpKey ( ) )
dbMoveObject ( 1, 1 );
if ( dbDownKey ( ) )
dbMoveObject ( 1, -0.9 );
if ( dbLeftKey ( ) )
dbMoveObjectLeft ( 1, 1 );
if ( dbRightKey ( ) )
dbMoveObjectRight ( 1, 1 );
float fPlayerX = dbObjectPositionX ( 1 );
float fPlayerZ = dbObjectPositionZ ( 1 );
float fPlayerFace = dbObjectAngleX ( 1 );
float fPlayerHeight = dbGetTerrainGroundHeight ( 2, dbObjectPositionX ( 1 ), dbObjectPositionZ ( 1 ) );
dbPositionObject ( 1, fPlayerX, fPlayerHeight+3.5, dbObjectPositionZ ( 1 ) );
dbSetCameraToFollow ( fPlayerX, fPlayerHeight+15, fPlayerZ, fPlayerFace, 50, 15, 2, 0 );
dbUpdateTerrain ( );
// update the screen
dbSync ( );
}
// before quitting delete our objects
for ( int i = 1; i < 50; i++ )
dbDeleteObject ( i );
// return back to windows
return;
}