Direct x 8 camera & matices

I just started using dx8 and noticed it's totaly different in rendering, certainly the matrices.

Now I created a 3d city and pointed the camera above it, like in GTA2. Now I would like to move the camera, but instead of just moving, he rotates around an axis.

Here's what I've wrote so far:

With Dev
    D3DXMatrixIdentity View
    D3DXMatrixIdentity Pos
    D3DXMatrixIdentity X
    D3DXMatrixLookAtLH View, MakeVector(0, 40, 0), MakeVector(0, 0, 0), MakeVector(1, 0, 0)
    .SetTransform D3DTS_VIEW, View
    D3DXMatrixTranslation Pos, 0, 40, 0
    D3DXMatrixMultiply View, Pos, X
    .SetTransform D3DTS_VIEW, View
    D3DXMatrixPerspectiveFovLH Proj, Game.Pi / 4, 1, 0.1, 500
    .SetTransform D3DTS_PROJECTION, Proj
    .Clear 0, ByVal 0, D3DCLEAR_TARGET Or D3DCLEAR_ZBUFFER, &H0, 1, 0

If anyone knows the right combinations of setting and multiplying, I would realy appreciate it.

Tranks in advance,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I am really bad at 3D math myself :) But I think that the reason you are having problems is that the camera Matrix is not behaving like you think it does. You can not add 40 to Y like you do because it give the opposite effect.

Remeber that the camera is the inverse of the world matrix. This means that moving your camera foward is the same as moving your world backward.

You have the position of your objects in row 4. so change the first x,y,z in that row and your camera should move.

D3DXMatrixInverse View
View._42 = View._42 + 40
D3DXMatrixInverse View
.SetTransform View

This code is more or less C++ you have to translate View._42 into whatever it's called in VB.

Hope it helps.
you have to move the camera and the look-at position.(eye)...( i dont know vb so i dont know if you do or not)

I think its easier to just move the entire world...

I use C++ as well, but I'm a former QB guy.
I got the movement of the camera and everything, but what you really should do is move the entire world if you want to skip changing the matrices for now.
There are some good tutorials on this at . One of them helped me through it, but I'm not sure I completely understand it yet. You must access the view matrix directly and change it to do this.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Here's what you do:

Establish the following variables:

Camera position (D3DXVECTOR3)
Orientation variables:
Facing Vector (D3DXVECTOR3)
Right Vector (D3DXVECTOR3)
Up Vector (D3DXVECTOR3)
Rotation Request Variables for each axis(only used to rotate, set to zero afterwards)

look at for the rest of this. I'm out of time for today. (sorry)


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Game Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.