Solved

Direct x 8 camera & matices

Posted on 2003-03-03
Medium Priority
286 Views
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
.BeginScene
...

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

Egsoc
0
Question by:egsoc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 4

Expert Comment

ID: 8056722
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.
0

LVL 1

Expert Comment

ID: 8087223
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...

0

LVL 1

Accepted Solution

RageDBL earned 225 total points
ID: 8349787
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 www.gamedev.net . 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.

RageDBL
0

LVL 1

Expert Comment

ID: 8592179
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 www.gamedev.net for the rest of this. I'm out of time for today. (sorry)

RageDBL

0

Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month14 days, 3 hours left to enroll