Archived

This topic is now archived and is closed to further replies.

nullmind

Matrix movement non-rotation

Recommended Posts

nullmind    152
Hi all. I have 3 matrices, one for Translation, Rotation and scaling. I''m attempting to create a small set of commands: Position: Sets the X, Y, and Z positions. Rotate: Sets the Yaw, Pitch and Roll. Scale: Sets the scaling All those functions simply set the values, like Rotation sets rotation to a specific value. Now I want to ''add'' values with these functions: Translate: Moves (not based on direction). Move: Moves (based on direction) Turn: Adds rotation. I had it going, and then ran into a small problem I have the three matrices, and I create the final matrix like this: matFinal = matTrans * matRot * matScale. It worked, but then I noticed that it was making my translations rotate around the origin. For example, if I rotate it, and I want to move it, all the movement is based on that rotation. I just want to move it around, and rotation is seperate.

Share this post


Link to post
Share on other sites
RhoneRanger    100
The _41 _42 and _43 portion of a matrix are the ones specifically for translation x y and z respectively.

You could multiply by Rot and Scale, and just manually set the translation. Saves on a matrix multiply.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
quote:
Original post by nullmind

It worked, but then I noticed that it was making my translations rotate around the origin. For example, if I rotate it, and I want to move it, all the movement is based on that rotation.


Of course.

I suggest you read up on transformations. You''ll be hopelessly confused if you take a trial-and-error approach here.

Share this post


Link to post
Share on other sites
nullmind    152
Ya, I''ve been trying to get as much information as I could from #gamedev. I''m not horrible at math, it''s just when people explain new concepts, they forgot to break it down and just go all out and babble like they are trying to proove something.

Anyhow, I have a question about Matrices. I know _41, _42 and _43 are the positions. What are the rest?

Also, I can rotate all my objects fine now and everything works. I am storing locations, rotation and scaling in D3DXVECTOR3 values, and calculating matrices when I need to. It works, but It isn''t working so great for my camera

Is the camera matrix different?

Share this post


Link to post
Share on other sites