# Connections between matrix transforms

## Recommended Posts

avion85    122
I am building a billiards-like game for my diploma for some time now. The physics part is done,and now i have problems with the representation of the balls and the table. These problems concern the basic transformations. Basically, all is well until i incorporate scaling, generally i need some balls larger, and some smaller.So here goes: 1.When i concatenate the traslation and rotation matrices, all is good, but when I multuply them with the scaling matrix everything goes haywire. The translation offsets also get scaled down, so the balls move less (if they're scaled down), and also rotate less! This means that the internal structure holding the present location of the ball thinks the ball is at (5,5,0) and reports so, but actually its at (1,1,0) because the whole thing was scaled down 5 times. The only way ofcourse to confirm its actual location was by me, visually, in reference to the wireframe of the table.This creates a gap between my data in the structures of the objects and their actual locations, which is ofcourse unacceptable coz' i need the exact data to calc collisions and physics. So my question, basically, is this: How do i separate trasnlation and rotation from the scaling matrix. I need the balls smaller but i need them to move exact values! ps. I use the ID3DXBaseEffect::SetMatrix for the transforms, along with ::CommitChanges, if that makes any difference. 2. I have a more general and basic question about the transforms. I use classes, ofcourse,to represent the balls, and variable members for matTrans, matRot, and matScale for each ball. What i want to know is, do i effect the world coordinate system in any way by applying transforms to the object? So if i create a translation matrix for moving an object +5 on the X axis is there a chance i might influence the rendering of other objects in the scene? What i do is: create matrix for +5 on x; matWorld = matTrans; mfx->setmatrix(...,matWorld*matView*matProjection); mfx->CommitChanges(); renderobject(); for each object. I hope i was clear, thanks.

##### Share on other sites
Matt_D    247
well, think about it in spaces.

scale the balls in the model->world space transform matrix. you should scale the balls *before* you translate them (otherwise, youll scale the transformation as you are finding).

order is important with matricies :)

##### Share on other sites
avion85    122
I cant thank you enough my friend! Problem solved in 2 seconds.I will never underestimate the awesomeness of this forum an the ppl ever again:)

## Create an account

Register a new account