Hi all.
After some frustrating attempts to implement jumping into my game, I finally was able to add in a perfect and smooth jumping system. That is, except for a major bug I just found. The character can perfectly jump while standing, moving forward, strafing, and moving diagonally, except he can't move back-right cause of this little bug. After doing some debugging and playing with code, I have realized that that there are some key combinations that totally screw up Dark Physics. For my game, the Space and S and D key, when pressed together, prevent Dark Physics from doing anything. When Space and S and A, or Space and S and W are pressed, or all the other key combinations in WASD movement involving Space key, everything works fine. Other key combinations are S and Z, Up and Left, and I'm sure there are more.
I even made a new program just to test this code:
int fCameraAngleX;
int fCameraAngleY;
int click=0;
void DarkGDK ( void )
{
dbSyncOn ( );
dbPhyStart();
dbSyncRate ( 60 );
dbMakeObjectBox(1,1000,10,1000);
dbPhyMakeRigidBodyStaticBox(1);
dbAutoCamOff();
while ( LoopGDK ( ) )
{
dbPositionObject(3,dbObjectPositionX(2),dbObjectPositionY(2)-21,dbObjectPositionZ(2));
dbPositionMouse ( dbScreenWidth()/2 , dbScreenHeight()/2 );
if (dbMouseClick()&& click==0)
{
click=1;
dbMoveCamera(50);
if (!dbObjectExist(2)) dbMakeObjectBox(2,10,10,10);
dbPositionObject(2,dbCameraPositionX(),dbCameraPositionY(),dbCameraPositionZ());
dbMoveCamera(-50);
}if (!dbMouseClick() && click==1) click=0;
if (dbUpKey()) dbMoveCamera(4);
if (dbDownKey()) dbMoveCamera(-4);
if (dbObjectExist(2) && dbPhyGetCharacterControllerExist(2)==0) dbPhyMakeBoxCharacterController( 2, dbObjectPositionX(2),dbObjectPositionY(2), dbObjectPositionZ(2), 10, 40,10 ,1, 10.5, 45.0);
//This tests the bug in the key combination. If Space, S, and D are pressed, move character forward. It dosen't work!
if (dbKeyState(31) && dbKeyState(32) && dbSpaceKey() ){dbPhyMoveCharacterController(2,100);}
//Now if I change the combination to Space, S, and A, it works!
if (dbKeyState(31) && dbKeyState(30) && dbSpaceKey() ){dbPhyMoveCharacterController(2,100);}
float OldCamAngleY = dbCameraAngleY ( 0 );
float OldCamAngleX = dbCameraAngleX ( 0 );
fCameraAngleX = dbWrapValue(fCameraAngleX + dbMouseMoveY() * 0.4f);
fCameraAngleY = dbWrapValue(fCameraAngleY + dbMouseMoveX() * 0.4f);
dbYRotateCamera( dbCurveAngle ( fCameraAngleY, OldCamAngleY, 5 ));
dbXRotateCamera( dbCurveAngle ( fCameraAngleX, OldCamAngleX, 5 ));
dbSync ( ); dbPhyUpdate();
}
}
Try it out yourself! Now, does anyone know any workarounds, or fixes? Is this just a Dark GDK only problem, or maybe installed Dark Physics wrong? I'm using the new May 2009 update, and perhaps that might have added this bug.
Please help!