Jump to content
  • Advertisement
Sign in to follow this  
avion85

Connections between matrix transforms

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
Share on other sites
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:)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!