저는 3D 공간에서 움직이는 여러 물체를 가지고 있으며 버튼을 누른 상태에서 카메라를 스냅하고 선택한 물체를 따라갈 수있는 방법을 찾고 있습니다.3D 모델의 세계 매트릭스를 기반으로하는 DirectX 카메라?
각 개체의 worldMatrix를 사용할 수있는 방법이 있습니까?
//set up matrices for rendering
D3DXMATRIX worldMatrixMer, viewMatrixMer, projectionMatrixMer;
m_Camera->GetViewMatrix(viewMatrixMer);
m_D3D->GetWorldMatrix(worldMatrixMer);
m_D3D->GetProjectionMatrix(projectionMatrixMer);
D3DXMatrixRotationX(&matRotateX, rx/65.0f);
//Rotate about Y axis
D3DXMatrixRotationY(&matRotateY, rotation * 15.0f);
D3DXMatrixRotationZ(&matRotateZ, rz/65.0f);
//Collate Rot Matrices
D3DXMATRIX rotMatrixMer = matRotateX * matRotateY * matRotateZ;
D3DXVECTOR3 newVecDirMer;
D3DXVec3TransformCoord(&newVecDirMer, &initVecDirMer, &rotMatrixMer);
D3DXVec3Normalize(¤tVecDirMer, &newVecDirMer);
//Create the size of the object
D3DXMATRIX matScaleMer;
D3DXMatrixScaling(&matScaleMer, 0.1f, 0.1f, 0.1f);
//Starting position of object
D3DXMatrixTranslation(&matTranslateMer, 0.0f, 0.0f, 3.5983f * 3);
//Rotate about it's own axis
D3DXMatrixRotationY(&worldMatrixMer, rotation);
worldMatrixMer *= rotMatrixMer * matScaleMer * matTranslateMer;
//'Orbit'
D3DXMatrixRotationY(&matOrbit, (-1000.0f * rotation)/88);
worldMatrixMer *= matOrbit;
정말 이런 일이 만드는 우아한 방법을 찾기 위해 노력하고있어 (아래 하나의 객체의 한 예입니다.이 사람은 & 궤도를 회전 행성이다), 그래서 어떤 제안을 주시면 감사하겠습니다. 내가 객체와 같은 카메라의 위치를 설정하여이 접근 할
감사
나를 위해 매트릭스를 분해 해 주셔서 감사합니다. 아마도 이것에 대해 알아 보겠습니다. –