Hey, I'm sort of new to DarkGDK. I was trying to create a 3rd person camera that would follow your character around while he moved. I also wanted to be able to right click and drag to rotate the camera thats behind the character, and then continue moving the character while preserving that camera rotation, but the camera still staying behind the character.
This is what I have so far...
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbLoadObject("wheel.x",1);
dbMakeCamera(1);
dbPositionObject(1,0,0,0);
dbPositionCamera(1,0,0,-10);
dbSetCameraToObjectOrientation(1,1);
while ( LoopGDK ( ) )
{
if(dbUpKey())dbMoveObject(1,0.7f);
if(dbDownKey())dbMoveObject(1,-0.4f);
if(dbLeftKey())dbTurnObjectLeft(1,3);
if(dbRightKey())dbTurnObjectRight(1,3);
//dbSetCameraToFollow(1, dbObjectPositionX(1), dbObjectPositionY(1), dbObjectPositionZ(1), dbObjectAngleY(1), 10, 0, 0, 0);
//dbYRotateCamera(dbObjectAngleY(1));
dbSync ( );
}
return;
}
The problem is that the dbSetCameraToFollow doesn't seem to work? When it's commented out, I get the wheel loaded and then I can see it and move it around in front of the camera. When I uncomment the commented code, I just get a green screen.
Someone please help! This has been confusing me for several days...