I was using the collision command so that when an object collided with another object it goes back one step.
// Dark GDK - The Game Creators - www.thegamecreators.com
// the wizard has created a very simple project that uses Dark GDK
// it contains the basic code for a GDK application
// whenever using Dark GDK you must ensure you include the header file
#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 );
dbLoadObject ( "base.x", 1 );
dbPositionObject ( 1, 0, 0, 0 );
dbRotateObject ( 1, 90.0f, 90.0f, 0.0f );
dbMakeLight ( 3 );
dbMakeObjectSphere ( 2, 10 );
dbSetObjectCollisionOn ( 2 );
dbPositionCamera ( 0, 0, 0 );
// our main loop
while ( LoopGDK ( ) )
{
dbControlCameraUsingArrowKeys ( 0, 0.1f, 1.0f );
if ( dbObjectCollision ( 2, 1 ));{
dbMoveCamera ( -0.1f );}
dbPositionObject ( 2, dbCameraPositionX ( ), dbCameraPositionY ( ), dbCameraPositionZ ( ) );
dbPositionLight ( 3, dbCameraPositionX ( ), dbCameraPositionY ( ), dbCameraPositionZ ( ) );
dbRotateLight ( 3, dbCameraAngleX ( ), dbCameraAngleY ( ), dbCameraAngleZ ( ) );
dbSetLightRange ( 3, 10.0f );
// update the screen
dbSync ( );
}
// return back to windows
return;
}
the problem is that when the ob ject hit the other object it kept on going backward. It never stopped.
So, is there a way to set the command so that it only goes back for a milisecond?