D3DXVECTOR3 src(0.0f,0.0f,-1.0f);
D3DXVECTOR3 r(1.0f,0.0f,0.0f);
D3DXMATRIX mYaw;
D3DXVec3TransformCoord(&r,&src,D3DXMatrixRotationY(&mYaw,mTurn));
D3DXVECTOR3 vCharPos(0.0f,0.0f,mWalkForward);
D3DXVECTOR3 vCharFacing(r.x,r.y,r.z);
D3DXVECTOR3 vEye;
D3DXMATRIX mxView;
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 );
Third person camera help directx 9
Started by Anddos, Apr 07 2012 01:05 AM
5 replies to this topic
#1
Posted 07 April 2012 - 01:05 AM
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
#2
Posted 07 April 2012 - 10:27 AM
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.c...9/LaraCroft.rar
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.c...9/LaraCroft.rar
#3
Posted 07 April 2012 - 05:48 PM
Download not available
The following download is not available:
https://rapidshare.c...9/LaraCroft.rar | 1.35 MB
The following download is not available:
https://rapidshare.c...9/LaraCroft.rar | 1.35 MB
#4
Posted 15 April 2012 - 12:41 PM
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.
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.
#5
Posted 16 April 2012 - 07:39 AM
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.
- Mikey
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.
- Mikey
#6
Posted 16 April 2012 - 11:05 AM
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?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












