what i want todo is follow the model and direction of the camera so it follows it, ive got it working so it follows the positon but i cant get the direction right
static float posy = 1.0f; //posy += 0.001f;
vEye = D3DXVECTOR3( vCharPos.x,0.25f , vCharPos.z += +6.0f ); //0.25f
D3DXVECTOR3 vAt ( vCharPos.x, 0.125f, vCharPos.z ), //0.0125f
vUp ( 0.0f, 1.0f, 0.0f );
vCharFacing.x *= .25; vCharFacing.y = 0.f; vCharFacing.z *= .25;
vEye -= vCharFacing;
vAt += vCharFacing;
D3DXMatrixLookAtLH( &mxView, &vEye, &vAt, &vUp );
d3ddev->SetTransform( D3DTS_VIEW, &mxView );
Your code is wrong.
At first you must be create two class: CModel and CCamera.
Class CModel: controls the you 3D model (loading model, draw model, keyboard input);
Class CCamera: camera follows for model; to the position of the model you have to add the vector of camera position;
I.e.you must be distinguished two things: Model position and Camera position. In the class CCamera you must be get Model position from class CModel and add vector specifies the offset of the camera relative to the model.
Look.xyz vector of model must look to where you turn a model of the keyboard. And Look.xyz vector of camera must look on the model.
In the class CModel you must be construct World Matrix for model and in the class CCamera you must be construct View Matrix for your model and whole your 3D world.
Its very simple. See my source code: https://rapidshare.com/files/1225886309/LaraCroft.rar
Download not available
The following download is not available:
https://rapidshare.com/files/1225886309/LaraCroft.rar | 1.35 MB
So why I can download this link, and you do not? Can you even use the Internet? At first go to link, second do click on "Download", and at the final click "Free download" and enjoy.
P.S. I often see your topics on the forum and I do not understand - you're really stupid or pretending? Really not understand, sorry.
Hi kurlyak, I would recommend against using classes.
How do you know if the OP likes OOP?
Try structs or open consideration for another next time outside your beliefs. Thank you.
20+ years of programming experience.
alright i manage to get the download to work in internet explorer, firefox wouldnt work for some reason , anyway this sample is wierd, there is a exe and src folder, i run the exe and see lara in third person but when i look at the src there is a first person camera?