私は3D飛行ゲームを作成しており、ビューにDXUTCameraを使用しています。
カメラにキャラクターの位置をとらせることはできますが、自分のキャラクターを3人目で見たいと思います。
これが一人称視点の私のコアです
//Put the camera on the object.
D3DXVECTOR3 viewerPos;
D3DXVECTOR3 lookAtThis;
D3DXVECTOR3 up ( 5.0f, 1.0f, 0.0f );
D3DXVECTOR3 newUp;
D3DXMATRIX matView;
//Set the viewer's position to the position of the thing.
viewerPos.x = character->x; viewerPos.y = character->y;
viewerPos.z = character->z;
// Create a new vector for the direction for the viewer to look
character->setUpWorldMatrix();
D3DXVECTOR3 newDir, lookAtPoint;
D3DXVec3TransformCoord(&newDir, &character->initVecDir,
&character->matAllRotations);
// set lookatpoint
D3DXVec3Normalize(&lookAtPoint, &newDir);
lookAtPoint.x += viewerPos.x;
lookAtPoint.y += viewerPos.y;
lookAtPoint.z += viewerPos.z;
g_Camera.SetViewParams(&viewerPos, &lookAtPoint);
では、カメラを第三者のビューに移動する方法を誰かが知っていますか?カメラの動きがスムーズになるようにタイミングを調整することをお勧めします。(別のカメラクラスを持ち込む代わりに、このコードを編集できることを望んでいます)