Ok also momentan ist es so dass sich die Kammera um das Objekt bewegt
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
9
|
m_vLookAt.x = sinf(m_fRotAngleY) + m_vPosition.x;
m_vLookAt.z = cosf(m_fRotAngleY) + m_vPosition.z;
m_vLookAt.y = sinf(m_fRotAngleX) + m_vPosition.y;
x = sinf(m_fRotAngleY )+ m_vLookAt.x;
y = sinf(m_fRotAngleX )+ m_vLookAt.y;
z = cosf(m_fRotAngleY )+ m_vLookAt.z;
Spieler.Move(x,y,z);
|
aber das bekomme ich schon noch irgendwie hin.
Achso es soll so ein Weltraumschooter geben wo man eben die Ansicht wchseln kann zwichen innen und außen wobei ich noch ein kleines Problem habe und zwar wenn ich mich um die Y-Achse drehen will müssen ja alle Objekte und die Skybox sich drehen jetzt hat meine Skybox eine eigene WorldMatrix und meine Objekte haben eine WorldMatrix
hier mal das Rendern von Objekten
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
void CModel::Render(void)
{
D3DXMATRIX TransMatrix;
D3DXMATRIX RotMatrix;
D3DXMATRIX RotMatrixX, RotMatrixY, RotMatrixZ;
//D3DXMATRIX WorldMatrix;
// Rotationsmatrizen anlegen
D3DXMatrixRotationX(&RotMatrixX,m_RotX);
D3DXMatrixRotationY(&RotMatrixY,m_RotY);
D3DXMatrixRotationZ(&RotMatrixZ,m_RotZ);
D3DXMatrixIdentity(&RotMatrix);
// und miteinander multiplizieren
D3DXMatrixMultiply(&RotMatrix,&RotMatrix,&RotMatrixX);
D3DXMatrixMultiply(&RotMatrix,&RotMatrix,&RotMatrixY);
D3DXMatrixMultiply(&RotMatrix,&RotMatrix,&RotMatrixZ);
// Transformations und Rotationsmatrix zur Weltmatrix zusammenfassen
D3DXMatrixMultiply(&WorldMatrix,&RotMatrix,&TransMatrix);
D3DXMatrixTranslation(&TransMatrix,m_vPosition.x,m_vPosition.y,m_vPosition.z);
D3DXMatrixMultiply(&WorldMatrix,&RotMatrix,&TransMatrix);
m_lpD3DDevice->SetTransform(D3DTS_WORLD,&WorldMatrix);
// durch alle Materialien/Texturen laufen
for(unsigned int i=0;i<m_nNumMaterials;i++)
{
// Material setzen
m_lpD3DDevice->SetMaterial(&m_lpMeshMaterials[i]);
// Textur setzen
if(NULL != m_lpMeshTextures[i])
{
m_lpD3DDevice->SetTexture(0,m_lpResManager->GetTexture(m_lpMeshTextures[i]));
}
else
{
m_lpD3DDevice->SetTexture(0,NULL);
}
// Mesh rendern
m_lpMesh->DrawSubset(i);
}
m_lpD3DDevice->SetTexture(0,NULL);
}
|
kann ich Theoretisch alles wieder in eine eigene WorldMatrix zusammenfassen und diese dann mit
D3DXMatrixRotationY verschieben oder liege ich da ganz falsch?
Danke schonmal für die Hilfe!!!