Problem with View Rotation[SOLVED]

This topic is 3812 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I built a camera class, but when I rotate my camera, the world doesn't turn, only the direction in which the camera travels changes here's the code

void Camera::Move(float x, float y, float z)
{

if((z != 0) && (yAng != 0))
{
int tempz = cos(D3DXToRadian(yAng)) * z;
int tempx = sin(D3DXToRadian(yAng)) * z;

X += tempx;
Z += tempz;
}

else
{

if(x)
{
X += x;
}

if(z)
{
Z += z;
}
}

if(y)
{
Y += y;
}

}

void Camera::Rotate(int x, int y, int z)
{

if(x)
{
xAng += x;
}

if(y)
{
yAng += y;
}

if(z)
{
zAng += z;
}

}

void Camera::Transform(LPDIRECT3DDEVICE9 device)
{

D3DXMatrixIdentity(&Trans);
D3DXMatrixTranslation(&Trans,X,Y,Z);

D3DXMatrixIdentity(&xRot);
D3DXMatrixIdentity(&yRot);
D3DXMatrixIdentity(&zRot);

if(X)
{
}

//if(Y)
//{
//}

if(Z)
{
}

D3DXMATRIX FinalRot,Final;

FinalRot = (xRot * yRot * zRot);
Final = FinalRot * Trans;

device->SetTransform(D3DTS_VIEW,&Final);

}


is there any noticeable problem?

Share on other sites
Take a look here.

Share on other sites
oh i'm an idiot, sorry, i accidently used my position values instead of rotation values in the rotations

1. 1
Rutin
42
2. 2
3. 3
4. 4
5. 5

• 9
• 27
• 20
• 14
• 14
• Forum Statistics

• Total Topics
633387
• Total Posts
3011608
• Who's Online (See full list)

There are no registered users currently online

×