Subscribe

RSS Feed (xml)

Powered By

Powered by Blogger

Google
 
xnahelp.blogspot.com

Kamis, 03 April 2008

Transformations Reloaded

An object can have one transformation applied to it or it can have many transformations
applied to it. We might only want to translate (move) an object, so we can update the
object’s world matrix to move it around in the world. We might just want the object to
spin around, so we apply a rotation transformation to the object over and over so it will
rotate. We might need an object we created from a 3D editor to be smaller to fit better in
our world. In that case we can apply a scaling transformation to the object. Of course, we
might need to take this object we loaded in from the 3D editor and scale it down and
rotate it 30 degrees to the left so it will face some object and we need to move it closer to
the object it is facing. In this case we would actually do all three types of transformations
to get the desired results. We might even need to rotate it downward 5 degrees as well,
and that is perfectly acceptable.
We can have many different transformations applied to an object. However, there is a
catch—there is always a catch, right? The catch is that because we are doing these transformations
using matrix math we need to be aware of something very important. We are
multiplying our transformation matrices together to get the results we want. Unlike
multiplying normal integers, multiplying matrices is not commutative. This means that
Matrix A * Matrix B != Matrix B * Matrix A. So in our earlier example where we want to
scale our object and rotate it (two different times) and then move it, we will need to be
careful in which order we perform those operations. We will see how to do this a little
later in the chapter.

0 komentar: