Hey, I'm new to gamedev.net and would love some help!
I've just started writing a game which I plan to be FPS. I've got the Camera class done which I'll dump the code for below.
I was just wondering if anyone could help me (like walk me through and explain each step) to convert this camera to a First Person Camera? Or link me to a tutorial that would? I started not long ago so I have a basic understanding of Vectors but I don't really understand anything like "normalizing" so I do need a bit of assistance
![]()
Also some basic tips on improving what I have and making it generally better. I'm a beginner so please go easy :3
Thanks!
===Camera source file===
//Camera source file
#include "Camera.h"
Camera::Camera(D3DXVECTOR3 pos, D3DXVECTOR3 lookAt, D3DXVECTOR3 up, float FOV, float aspect)
{
Camera::pos = pos;
Camera::lookAt = lookAt;
Camera::up = up;
D3DXMatrixPerspectiveFovLH(&projection, FOV, aspect, 0, 100);
}
void Camera::UpdateLook()
{
D3DXMatrixLookAtLH(&view, &pos, &lookAt, &up);
}
===Camera.h===
//Camera header
#include "Main.h"
class Camera
{
private:
D3DXVECTOR3 pos;
D3DXVECTOR3 lookAt;
D3DXVECTOR3 up;
public:
D3DXMATRIX view;
D3DXMATRIX projection;
Camera(D3DXVECTOR3 pos, D3DXVECTOR3 lookAt, D3DXVECTOR3 up, float FOV, float aspect);
void UpdateLook();
};
===Where Camera is in main file===
//Draw Code camera.UpdateLook(); rd3dDevice->SetTransform(D3DTS_VIEW, &camera.view); rd3dDevice->SetTransform(D3DTS_PROJECTION, &camera.projection);
Edited by littletray26, 29 May 2012 - 01:12 AM.






