I am trying to make an object move around a world and he moves like he should. The problem I am having is that when he rotates the camera doesn't rotate reflexively. The first commands I used would rotate the camera correctly but since the location of the camera doesn't move when I rotate, you can see where the camera doesn't look at the object anymore.
void userinput( void )
{
//set camera to sit slightly behind and above player
dbPositionCamera (dbObjectPositionX(15), dbObjectPositionY(15) + 150, dbObjectPositionZ(15) - 350);
dbPointCamera(15,NULL,NULL,NULL);
dbObjectPositionY(15) + 150, dbObjectPositionZ(15) -300, 15, 100, 75, 1, 1);
// move the player forwards
if ( dbUpKey ( ) )
dbMoveObject ( 15, -10 );
//dbPlayObject (15, 14, 150);
//dbSetCameraToFollow ( float fX, float fY, float fZ, float fAngle, float fDistance, float fHeight, float fSmooth, int iCollision )
dbSetCameraToFollow (dbObjectPositionX(15), dbObjectPositionY(15), dbObjectPositionZ(15) - 300, 10, 100, 100, 1, 1);
// move the player backwards
if ( dbDownKey ( ) )
dbMoveObject ( 15, 10 );
// rotation
if(dbLeftKey ())
dbTurnObjectLeft(15, 10);
if(dbRightKey())
dbTurnObjectRight(15, 10);
dbSync ( );
}
ALL the commented stuff I have tried using. The object number is 15. How can I make it so the camera is always looking at his back even when he rotates?
/*================================================*\
| Lead Programmer/Owner===============Anti-Triangle Cult=====|
\*================================================*/