matrices and view transformation
Author Message
matrices and view transformation

Hi.

I am trying to build a 3D shoot-em-up style camera view,
where the camera can rotate and move through the world.

I have noticed that when you use matrices for
transformations, if you apply the rotation before the
translation, you end up moving along the identity x and z
planes when trying to strafe or move forward or backward
instead of moving along the "new" x and z planes. If i
concatenate the treanslation first, then the moving
works, but now the rotation rotates around the world
origin rather than around the camera.

I know I can do it using pythagoras with the
d3dxmatrixLookatLH function, but being a lazy programmer
and not much of a mathematician, I was hoping there was
an easier way to do this.

Any ideas would be appreciated.
Thanks.

Johann.

Sat, 25 Jun 2005 16:18:27 GMT
matrices and view transformation
I'm not sure why you would want to rotate again, could you explain a bit
more each step you take?

Mike.

Quote:

> Hi.

> I am trying to build a 3D shoot-em-up style camera view,
> where the camera can rotate and move through the world.

> I have noticed that when you use matrices for
> transformations, if you apply the rotation before the
> translation, you end up moving along the identity x and z
> planes when trying to strafe or move forward or backward
> instead of moving along the "new" x and z planes. If i
> concatenate the treanslation first, then the moving
> works, but now the rotation rotates around the world
> origin rather than around the camera.

> I know I can do it using pythagoras with the
> d3dxmatrixLookatLH function, but being a lazy programmer
> and not much of a mathematician, I was hoping there was
> an easier way to do this.

> Any ideas would be appreciated.
> Thanks.

> Johann.

Sun, 26 Jun 2005 10:37:30 GMT
matrices and view transformation
HI.

I have figured it out - it's one of those kick me for
being stupid things.

What I was doing was caching camera angles and x,y and z
coordinates and building transform matrices from these.
Then applying these transforms to the view. In essense i
was recalculating my next view entirely from the world
origin, which is not a problem when applying translation,
but after having applied a rotation, you would
essentially need to recalculate all previous movents from
the world origin to get the exact same view.

STOOOOPID!

What I've done now is I cache my current view matrix and
merely apply a rotation of 1 "degree" or translation of
1 "step" the necessary direction.

Works perfectly -even circle strafing is smooth.

There is even a function to retrieve your current view
using getTransform so you don't need to cache it.

Quote:
>-----Original Message-----
>I'm not sure why you would want to rotate again, could
you explain a bit
>more each step you take?

>Mike.

>> Hi.

>> I am trying to build a 3D shoot-em-up style camera
view,
>> where the camera can rotate and move through the world.

>> I have noticed that when you use matrices for
>> transformations, if you apply the rotation before the
>> translation, you end up moving along the identity x
and z
>> planes when trying to strafe or move forward or
backward
>> instead of moving along the "new" x and z planes. If i
>> concatenate the treanslation first, then the moving
>> works, but now the rotation rotates around the world
>> origin rather than around the camera.

>> I know I can do it using pythagoras with the
>> d3dxmatrixLookatLH function, but being a lazy
programmer
>> and not much of a mathematician, I was hoping there was
>> an easier way to do this.

>> Any ideas would be appreciated.
>> Thanks.

>> Johann.

>.

Sun, 26 Jun 2005 15:38:46 GMT

 Page 1 of 1 [ 3 post ]

Relevant Pages