Thunder2002

Hi,

when I load my models they don't always have the correct size in relation to each other, so i want to scale them. When i multiply the world matrix of the basic-effect that renders the model with a Matrix.CreateScale(0.2f) matrix i get the visual correct result. But the coords are scaled too. So when i want to set the position of my model i need to multiply the x, y and z coords by 5 to get the correct values for the model world matrix.
Does anyone have an idea to only scale the model in visual I already tried to multiply the view and/or projection matrices with a Matrix.CreateScale(0.2f) matrix but I only got crapy results... at least I am not very familiar with matrices

Thx & bye Thunder2002


Re: XNA Framework Model scaling without effecting the real coords

dczraptor

Whenever you are dealing with multiple matrices, make sure you multiply them in this order: scaling, rotation, translation. So for your code, (I'm assuming that you dont' have rotation yet), do this:

effect.World = Matrix.CreateScale(0.2f) * Matrix.CreateTranslation(position);

The reason is that if you do translation first, the scale will modify anything before it. In this case, it will take position and multiply by 0.2f.






Re: XNA Framework Model scaling without effecting the real coords

Thunder2002

Ah yeah, thank you very much, now if I think about that its more then logical