I am trying to make a camera class but when I call the functions the camera doesn't move can anyone tell me why.
Here is the code
#include "DarkGDK.h"
class CameraWorx
{
private:
int CameraNumber; // Holds the Cameras Number.
float CameraX; // Holds the currant X camera coordanate.
float CameraY; // Holds the currant Y camera coordinate.
float CameraZ; // Holds the currant Z camera Coordinate.
int CamForwardZ;
float CameraXAngle; // Holds the currant X rotation of the camera.
float CameraYAngle; // Holds the currant Y rotation of the camera.
float CameraZAngle; // Holds the currant Z rotation of the camera.
int CameraVelocity; // Holds the cameras max Velocity.
int ZoomSencitivity; // Holds the Amount of steps the camera zoomms in at a time.
public:
CameraWorx (int, int); // The defalt constructor for the CameraWorx Class.
~CameraWorx( void ); // The defalt destructor for the CameraWorx Class.
void cwMoveLeft(void); // Moves the camera left along the X axes regardless of the way it is facing.
void cwMoveRight(void); // Moves the Camera right along the x axes regardless of the way it is facing.
void cwMoveUp(void); // Moves the camera Up along the Y axes regardlessless of the way it is facing.
void cwMoveDown(void); // Moves the camera down along the y axes regardless of the way it is facing.
void cwMoveForward(int); // Moves the camera forward along the z axes regarles of the way it is facing.
void cwMoveBackward(void); // Moves the camera backward along the z axes regardles of the way it is facing.
void cwZoomIn(void); // Moves the camera forward in the way the camera is facing like it is zooming in.
void cwZoomOut(void); // Moves the camera backward oposite of the way it is facing like it is zooming out.
void cwRotateX(float); // Rotates the camera on the X axis.
void cwRotateY(float); // Rotates the camera on the Y axis.
void cwRotateZ(float); // Rotates the camera on the Z axis.
void cwPitchUp(float); // Pitches the camera up.
void cwPitchDown(float); // Pitches the camera down.
void cwPointAt(int,int,int); // Point the camera at the specified X,Y,Z coordinate.
};
CameraWorx::CameraWorx(int Camera_Number, int Camera_Velocity) // The CameraWorx function accepts the camera number.
{
CameraNumber = Camera_Number;
CameraVelocity = Camera_Velocity;
}
CameraWorx::~CameraWorx() // The Destructor.
{
dbDeleteCamera(CameraNumber);
}
void CameraWorx::cwMoveLeft(void)
{
CameraX = dbCameraPositionX(CameraNumber);
CameraY = dbCameraPositionY(CameraNumber);
CameraZ = dbCameraPositionZ(CameraNumber);
dbPositionCamera(CameraNumber,CameraX,CameraY,CameraZ);
CameraX -= CameraVelocity;
}
void CameraWorx::cwMoveRight(void)
{
CameraX = dbCameraPositionX(CameraNumber);
CameraY = dbCameraPositionY(CameraNumber);
CameraZ = dbCameraPositionZ(CameraNumber);
dbPositionCamera(CameraNumber,CameraX,CameraY,CameraZ);
CameraX += CameraVelocity;
}
void CameraWorx::cwMoveUp(void)
{
CameraX = dbCameraPositionX(CameraNumber);
CameraY = dbCameraPositionY(CameraNumber);
CameraZ = dbCameraPositionZ(CameraNumber);
dbPositionCamera(CameraNumber,CameraX,CameraY,CameraZ);
CameraY += CameraVelocity;
}
void CameraWorx::cwMoveDown(void)
{
CameraX = dbCameraPositionX(CameraNumber);
CameraY = dbCameraPositionY(CameraNumber);
CameraZ = dbCameraPositionZ(CameraNumber);
dbPositionCamera(CameraNumber,CameraX,CameraY,CameraZ);
CameraY -= CameraVelocity;
}
void CameraWorx::cwMoveForward(int CamZ)
{
CamZ = CamForwardZ;
CameraX = dbCameraPositionX(CameraNumber);
CameraY = dbCameraPositionY(CameraNumber);
CameraZ = dbCameraPositionZ(CameraNumber);
dbPositionCamera(CameraNumber,CameraX,CameraY,CameraZ);
CameraZ += CamForwardZ;
}
void CameraWorx::cwMoveBackward(void)
{
CameraX = dbCameraPositionX(CameraNumber);
CameraY = dbCameraPositionY(CameraNumber);
CameraZ = dbCameraPositionZ(CameraNumber);
dbPositionCamera(CameraNumber,CameraX,CameraY,CameraZ);
CameraZ -= CameraVelocity;
}
void CameraWorx::cwZoomIn(void)
{
CameraX = dbCameraPositionX(CameraNumber);
CameraY = dbCameraPositionY(CameraNumber);
CameraZ = dbCameraPositionZ(CameraNumber);
dbMoveCamera(CameraNumber,ZoomSencitivity);
}
void CameraWorx::cwZoomOut(void)
{
CameraX = dbCameraPositionX(CameraNumber);
CameraY = dbCameraPositionY(CameraNumber);
CameraZ = dbCameraPositionZ(CameraNumber);
dbMoveCamera(CameraNumber,ZoomSencitivity * -1);
}
void CameraWorx::cwPitchUp(float Pitch_Angle)
{
dbPitchCameraUp(CameraNumber,Pitch_Angle);
}
void CameraWorx::cwPitchDown(float Pitch_Angle)
{
dbPitchCameraDown(CameraNumber,Pitch_Angle);
}
All is revealed with time.