Hello all,
i m making a FPS game i m new to GDK i m unable to add collisions and gravity please someone help me here is my code and demo video..
PLEASE SOMEONE HELP ME HOW TO ADD GRAVITY AND COLLISIONS
THANKS
#include "DarkGDK.h"
int fCameraAngleX;
int fCameraAngleY;
void mouse(void);
void LoadMap()
{
dbLoadObject("media//maps//Kill_house.X",11);
dbPositionObject(11,0,-80,0);
}
void LoadPlayer()
{
dbLoadObject("media//Objects//fire.X",10);
dbLockObjectOn(10);
dbSetObjectAmbient(10,0);
dbSetObjectAmbience(10,0x00000000);
dbFixObjectPivot(10);
dbDisableObjectZDepth(10);
dbPlayObject(10);
}
void DarkGDK ( void )
{
dbSyncOn();
dbSyncRate(60);
dbAutoCamOff();
dbObjectCollision(10,11);
LoadMap();
LoadPlayer();
while ( LoopGDK ( ) )
{
dbSync ( );
mouse();
//dbControlCameraUsingArrowKeys(0, 2.0f, 2.0f);
dbMakeMatrix(4, 100, 100, 10, 10);
}
return;
}
void mouse(void)
{
if (dbKeyState (17))//(dbUpKey())
{
dbMoveCamera(6);
}
if (dbKeyState (31))//(dbDownKey())
{
dbMoveCamera(-6);
}
if (dbKeyState (30))//(dbLeftKey())
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) - 90 );
dbMoveCamera(6);
}
if (dbKeyState (32))//(dbRightKey())
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) + 90 );
dbMoveCamera(6);
}
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbMouseMoveY ( ) * 0.3f );
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbMouseMoveX ( ) * 0.3f );
//rotate camera
dbXRotateCamera ( fCameraAngleX );
dbYRotateCamera ( fCameraAngleY );
}
Here is The Sample Video
http://www.youtube.com/watch?v=MhAa7PW4q3M