Game Programming and Development Tools

Matrix Problems... – ThirddaySaved



Posts: 30
From: MA,USA
Registered: 07-26-2007
Hello, I am having another problem. I am using a First Person View... the code is like this...

dim Rotation as single
dim Z as single
dim Y as singe
dim ViewMat as matrix = matrix.identity

' Put all my Initilization here the Direct3D.Device used
' Shall be called D3DDev.
End Sub

' This Sub is where all actual rendering is done
ViewMat = ViewMat * Matrix.Translation(0,Y,Z)
ViewMat = ViewMat * Matrix.RotationY(Rotation)
D3DDev.Transformation.View = ViewMat
' Now, Right here I want to be able to find where my View Matrix
' actually is. The Transformation's above change the translation, but it
' doesn't seem to be the true location of the camera. I need the location of
' the camera so I can check it with the location of my objects for collision.
' The objects are all in the World Matrix, and do not move. That meens they
' are constently centered at 0,0,0 while my camera is changing. How can I
' find the position of my camera in the world matrix?
End Sub

I need to find the position of my camera in the world matrix, even after the transformations have been applied... Here is an example... If I start the View Matrix at 0,0,0 and look here 0,0,100... then I move forward 10 spaces, and rotate the matrix 90 degrees... I once again move 10 more spaces... (I am only moving along the Z axis, and Rotating Y) the Camera should be positioned at (10,0,10) in world space. That is what I do not know how to cumpute... I thought maybee I needed to use Vector3.Normalize(), or Vector3.TransformCoordinate(), or Vector3.Dot, or ETC... but I do not know what exactly those things do. Any help would be fantastic, and Thank You in advance!

~~ Peace, John 3.16 ~~



Posts: 484
From: Queensland, Australia
Registered: 03-16-2006
sent you a PM..