Quote:Original post by KulSeran
Quote:
Matrix.CreateTranslation( 0, 0, -1.0 ) * rocketMat;
Won't multiplying the rocketMatrix and then by CreateTranslation be a world transformation or would that only occur if I did rocketMat * Matrix.CreateTranslation(0,0,-1.0)? Aside from that, what you would be doing would be positioning the flame above the rocket one unit in the z-direction on the object's[\b] local z-axis correct?
Sure, it is a "world transformation" but all transformations end up in the world.
See, you have your OBJECTS matrix "rocketMat", and you wanted some point in world space that is RELATIVE to your OBJECT. So, you take the OBJECT matrix, and use it as the starting point. If you don't care about any one object, you take the ORIGIN (matrix.identity) as your starting point.
Quote:
Like I mentioned in the previous post, very helpful into understanding that my origin can be whatever I want it to define but I need clarification as to what exactly I would use to represent my object space through a matrix...that's probably the remaining thing I'm confused about.
Yeah. Your "Object space" of the rocket is rocketMat. If you took the columns (rows in directx?) of the matrix, you'd get the X,Y,Z, axis and position of the rocket. Multiplying in another translation after your object's matrix is equivelent to using those local XYZ axis to move away from the local position described in the rocketMat.
Maybe picking up some reading on linear algebra would help?
I finally get it I believe.
Relating to the rotation and translation thing vs translation then rotation:
My object space is initially aligned with my world space. If I do a rotation at the beginning, both my X and Y axis will rotate around my local space's origin. It spins because I am literally shifting the axis as I rotate and thus I can achieve the spinning motion. If I then do a translation, I am now in my world space which makes sense, I am just saying "here is my object origin in relation to the world origin" which in my case is set the same as my screen space at (0,0). When I specify to rotate in this space, I am actually rotating the object itself, not the axis as I was doing in local space which is why it orbits.
In relation to to the transformations of the missile let's say above the carriage. I first can do something like this (doing this from left to right):
Rotate carriage 50 degrees around local space's origin, translate to (10,10,0)
Now, if I want some missile to be on top of the carriage rotated, I would do:
Rotate missle 50 degrees around local space origin, Translate to (1,1,0).
Now, reading from left to right, I would then multiply my world transformation for my carriage by the world transformation of my rocket and will get this rocket above.
So my order is if I wanted to do it out (from left to right):
rotMatrixCarriage(50) * tranMatrixCarriage(10,10,0) * rotMatrixRocket(50) * tranMatrixRocket(1,1,0).
or
1.Rotate my rocket 50 degrees around the local origin.
2.Put the rocket (10,10,0) in the world space
3. Rotate rocket by 50 degrees (I'm assuming this is in local space but am unsure)
4. Put the rocket above the carriage so right 1 and up 1
I would apply this sequence to my origin of my rocket and end up where I want.
One final question. After the first two transformations of the carriage, is rotMatrixRocket doing 50 around the world origin or my local object origin? I ask because after my two matrix transformations for the carriage, I am now in world space so naturally in my head I would think that something like a rotation in the world space would orbit around the world origin. If it is in the local space, why does rotation occur in the local space vs the world space?