Hi, im trying to make a third person game but im having some trouble with the Camera. When the player object moves left or right the camera seems to jitter. My guess its because the camera moves at the same speed as the player when its at a certain distance but when its moving left and right in relation to the camera the camera is moving too fast. Im very unsure how to fix this one, Thanks in Advance.
// Get Camera Distance From Player
PlayerX = dbObjectPositionX ( 1 );
PlayerY = dbObjectPositionY ( 1 );
PlayerZ = dbObjectPositionZ ( 1 );
CameraX = dbCameraPositionX ( );
CameraY = dbCameraPositionY ( );
CameraZ = dbCameraPositionZ ( );
DistanceX = PlayerX - CameraX;
DistanceY = PlayerY - CameraY;
DistanceZ = PlayerZ - CameraZ;
Distance = dbSqrt( DistanceX * DistanceX + DistanceY * DistanceY + DistanceZ * DistanceZ );
// Move Camera If Distance Is Too Great
if ( Distance >= 4 )
{
dbXRotateCamera ( 0 );
dbMoveCamera ( 0.1f );
}
// Point Camera At The Player Object
dbPointCamera ( PlayerX, PlayerY, PlayerZ );