Camera movement 
Author Message
 Camera movement

Hi all, this is my first post cause its only 2 week that i work with
DX+VB.NET.
I've a series of problem, first of all find a book (yes i'm italian and no
book on shelf) any good title?
Second, i've create my 3d scene with a very simple mesh handler class:
create basic mesh, load from . X and load multi texture. Now I've created a
cCamera class that use:

D3DDev.Transform.View = Matrix.LookAtLH(Position, LookAt, vUpVec)
D3DDev.Transform.Projection = Matrix.PerspectiveFovLH(CSng(Math.PI / 4),
1.0F, 1.0F, 100.0F)

for moving in 3 axes, now im tryng to move point of view (hold camera
position but moving observation point), i tihink is good to use:

tMatrix = Matrix.Add(tMatrix, Matrix.RotationX(Rotation.X \ 10))
D3DDev.Transform.World = tMatrix

For each axis, but it doesnt work, i've some problem with matrix operation,
and i need some theory, but i cant find (ita or english doesnt matter) i've
seen dx4vb but i didnt find anything..

Any idea for my problem?
Thank you.....

MELLO



Tue, 04 Oct 2005 20:54:09 GMT  
 Camera movement
I Did it ... i was wrong, now i do this:

Public Function Move()
    Dim vUpVec As New Vector3(0.0F, 1.0F, 0.0F)
    Static Tvect As Vector3

    If Tvect.X <> Rotation.X Then
        LookAt.X -= CSng(Math.Sin(3.14 * (Rotation.X) / 180)) / 5.0F
        Tvect.X = Rotation.X
    End If

    If Tvect.Y <> Rotation.Y Then
        LookAt.Y += CSng(Math.Sin(3.14 * (Rotation.Y) / 180)) / 5.0F
        Tvect.Y = Rotation.Y
    End If

    If Tvect.Z <> Rotation.Z Then
        LookAt.Z = CSng(Math.Cos((8.0F * Rotation.Z)))
        Tvect.Z = Rotation.Z
    End If

    D3DDev.Transform.View = Matrix.LookAtLH(Position, LookAt, vUpVec)
    D3DDev.Transform.Projection = Matrix.PerspectiveFovLH(CSng(Math.PI / 4),
1.0F, 1.0F, 100.0F)
End Function

Now the problem is if i change the Position i've to change LookAt adding the
offset, but with a small of Matrix operation ill do it

Quote:

> Hi all, this is my first post cause its only 2 week that i work with
> DX+VB.NET.
> I've a series of problem, first of all find a book (yes i'm italian
> and no book on shelf) any good title?
> Second, i've create my 3d scene with a very simple mesh handler class:
> create basic mesh, load from . X and load multi texture. Now I've
> created a cCamera class that use:

> D3DDev.Transform.View = Matrix.LookAtLH(Position, LookAt, vUpVec)
> D3DDev.Transform.Projection = Matrix.PerspectiveFovLH(CSng(Math.PI /
> 4),
> 1.0F, 1.0F, 100.0F)

> for moving in 3 axes, now im tryng to move point of view (hold camera
> position but moving observation point), i tihink is good to use:

> tMatrix = Matrix.Add(tMatrix, Matrix.RotationX(Rotation.X \ 10))
> D3DDev.Transform.World = tMatrix

> For each axis, but it doesnt work, i've some problem with matrix
> operation, and i need some theory, but i cant find (ita or english
> doesnt matter) i've seen dx4vb but i didnt find anything..

> Any idea for my problem?
> Thank you.....

> MELLO



Tue, 04 Oct 2005 22:42:44 GMT  
 Camera movement


<snip>

Quote:
> D3DDev.Transform.View = Matrix.LookAtLH(Position, LookAt, vUpVec)
<snip>
> for moving in 3 axes, now im tryng to move point of view (hold camera
> position but moving observation point),

Change the LookAt vector in the view matrix to the new coordinates the
camera must look at.  If you also want to simulate camera rotation,
change the vUpVec vector to specify the direction that's "up" with
respect to the camera.

Keep this common to the entire scene (change only once per frame), or
you can get strange (but sometimes pretty) results.

The world matrix can remain the same as it was, per object, without
any changes for the camera position.

Treat it as if you're looking at a real scene: you can walk through a
room (= camera movement) without moving any objects in it (= world
matrixes per object).

The projection matrix gives a reference for the room itself, like how
large it is (what scale or units you're using for the entire scene).

Quote:
> i tihink is good to use:
> tMatrix = Matrix.Add(tMatrix, Matrix.RotationX(Rotation.X \ 10))
> D3DDev.Transform.World = tMatrix

Multiply matrixes instead of adding them if you want to combine them,
for example:

Device.Transform.World = Matrix.Multiply( _
    Matrix.RotationX(Angle), _
    Matrix.Translation(X,Y,Z))

The result is as if the operations are applied one after the other
(left to right in the multiplication): in this example the object will
seem to rotate around its own axis at position (X,Y,Z), but if you
reverse the arguments to .Multiply it will seem to orbit around the
origin at a distance determined by (X,Y,Z).

Combining the rotation of the earth around its axis with the orbit it
describes around the sun would require three matrixes: rotation around
its axis (period = one day), multiplied by a translation for the
distance from the sun, multiplied by a second rotation for the orbit
(period = one year).

A misconception that's easy to make is that a world matrix describes
the world an object is placed in: it's the other way around, it
specifies how an object is placed with respect to the world.
The world itself (the common reference system used by the camera and
world matrixes) is determined by the projection matrix.

So if you render multiple objects, you start out with exactly one
world matrix, exactly one view (camera) matrix, and [one world matrix
per object] - parentheses around the last for extra clarity.

You could say that the view matrix is the camera's analog for a world
matrix.

This was not a book, but I hope it will help you get started ;-)



Tue, 04 Oct 2005 23:15:29 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. DirectX7 simple camera movement

2. D3DIM Camera Movement

3. DirectX7, Camera movement

4. Capturing Mouse Movement Before Pointer Movement

5. Capturing Mouse Movement Before Pointer Movement

6. Capturing Mouse Movement Before Pointer Movement

7. Intel PC Camera Snapshot

8. Controlling a digital camera from a bound object frame

9. Retrieve embedded information from jpg file (digital camera picture)

10. Windows Application Using A Digital Camera

11. Video capture from a camera

12. I BUY OLD CAMERAS in SO CALIF

 

 
Powered by phpBB® Forum Software