Hey guys, I'm trying to make a third person shooter and I'm having a lot of trouble getting the camera and player control right.
I currently have a player object and a control object which can move around the player object (forward, back, strafe left/right).
What I need help with is the camera placement. I need the camera to act like a third person view, so that its over the shoulder of the player and when the player rotates the camera it also rotates the player object.
I was wondering if you guys could make a few suggestions for me on how to get it working right.
Also, any code samples would be appreciated.
[Below is my code, but its such a mess because it doesn't work at all]
void TPS::Update()
{
// create a rotation axis based on controller movement
fCameraAngleX = dbWrapValue ( fCameraAngleX + controller->GetVeiwX() );
fCameraAngleY = dbWrapValue ( fCameraAngleY + controller->GetVeiwY() );
// rotate camera
//dbXRotateCamera ( fCameraAngleY );
//dbXRotateObject(player->id,fCameraAngleY);
dbTurnCameraLeft( fCameraAngleX/250 );
dbYRotateObject(player->id,fCameraAngleX);
dbPositionCamera( player->x+50, player->y+100,player->z-50 );
//dbPointCamera (player->x, player->y, player->z);
}