   3rd person camera, Problem
  I try to build 3rd person camera.I want to make the camera that follows my aircraft and also rotate follow my air craft. I can make camera follow the aircraft but when I rotated aircraft,as I saw, aircraft stay same as nothing happen. But the land was rotating.I do not understand which why it like this. Can anybody guide me in simple way.On internet, I still cannot find what I actually want.void CCamera::Update(D3DXMATRIX *ObjectPosition){vCameraUp.x = ObjectPosition->_21;vCameraUp.y = ObjectPosition->_22;vCameraUp.z = ObjectPosition->_23;D3DXVec3TransformCoord(&vCameraView,&view_pos,ObjectPosition);D3DXVec3TransformCoord(&vCameraWatch,&watch_pos,ObjectPosition);D3DXMatrixLookAtLH(&matView,&vCameraView,&vCameraWatch,&vCameraUp);CGraphics::GetDevice()->SetTransform(D3DTS_VIEW,&matView);}
  That sounds right. The camera is always behind the aircraft no matter which way it is rotating.What you probably want is to smoothly move the camera to the new position behind the aircraft, by interpolation. You'd need to get the target position and your current position and move between the two. Use the new value as the eye for your lookat matrix.[Edited by - RabidDog on May 14, 2010 7:36:25 AM];Quote:Original post by RabidDogThat sounds right. The camera is always behind the aircraft no matter which way it is rotating.What you probably want is to smoothly move the camera to the new position behind the aircraft, by interpolation. You'd need to get the target position and your current position and move between the two. Use the new value as the eye for your lookat matrix.Thanks for your advice.But I still do not get it.It should not be like.....previous position = current position;then....??Can you show me some sample?;Click here for a larger versionNot sure if it makes any more sense, probably not :p1) You're flying straight ahead2) You've turned the plane the camera is "slowly" turning after it3) You've turned the plane the camera is "slowly" turning after it4) Camera has turned enough to be straight behind the camera again.You'll want to save a "target rotation" when the plane moves, then slowly turn towards that position/rotation over the next frames/seconds.Of course by slowly, were talking maybe a second or two, depending on how steeply the plane turns.And you'll want to make sure the camera doesnt lag too far behind, set a minimum % or so.. :)   ;Quote:Original post by marius1930Click here for a larger versionNot sure if it makes any more sense, probably not :p1) You're flying straight ahead2) You've turned the plane the camera is "slowly" turning after it3) You've turned the plane the camera is "slowly" turning after it4) Camera has turned enough to be straight behind the camera again.You'll want to save a "target rotation" when the plane moves, then slowly turn towards that position/rotation over the next frames/seconds.Of course by slowly, were talking maybe a second or two, depending on how steeply the plane turns.And you'll want to make sure the camera doesnt lag too far behind, set a minimum % or so.. :)Your picture is clear what I have to.Problem is I tried to store the value of previous move but I do not know actually how to do.I searched on Internet and saw some tutorials.However, it is complicated to me.I want to do in my way.On my code, still have a problem that I need to set .....kind of lags for camera.I think in Directx will have any functions that will help me to figure out or I understand somrthing wrong.CCamera::CCamera(){view_pos.x  = 0;view_pos.y  = 0;view_pos.z  = 5;watch_pos.x  = 0;watch_pos.y  = 20;watch_pos.z  = -300;}void CCamera::Update(D3DXMATRIX *ObjectPosition){D3DXMATRIX matView;D3DXVECTOR3 vCameraView,vCameraWatch,vCameraUp;vCameraUp.x = ObjectPosition->_21;vCameraUp.y = ObjectPosition->_22;vCameraUp.z = ObjectPosition->_23;D3DXVec3TransformCoord(&vCameraView,&view_pos,ObjectPosition);D3DXVec3TransformCoord(&vCameraWatch,&watch_pos,ObjectPosition);D3DXMatrixLookAtLH(&matView,&vCameraView,&vCameraWatch,&vCameraUp);CGraphics::GetDevice()->SetTransform(D3DTS_VIEW,&matView);*/}According to my code, I think view_pos and watch_pos need to be dynamic??Someone told me that it is not necessary.... But I guess it should not be like that.Can you help me to clear this problem?   