#### Archived

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

# Matrix movement non-rotation

This topic is 5417 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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 on other sites
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 on other sites
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 on other sites
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?

1. 1
Rutin
38
2. 2
3. 3
4. 4
5. 5

• 12
• 15
• 12
• 14
• 9
• ### Forum Statistics

• Total Topics
633354
• Total Posts
3011494
• ### Who's Online (See full list)

There are no registered users currently online

×