[quote]its not heading in the direction of the new rotation tranform. it just keeps heading into z, with the object spining around itself without a care.
i would like it to move in the direction of the rotation. and then on the next update just tell the transform to move in z a little bit more. and because the rotation vector has changed - it heads off in that new changed direction.
[/quote]
But, looking at your example code you only have one translation followed by one rotation… If you only ever adjust the Z coordinate of the translation then rotate after that you will never move along anything but the Z axis.
To move the object in the direction of the heading. you will need to rotate the vector that you are adding to the translation vector.
E.g. the code way above always adds 0,0,-5 to the translation vector. that is assuming the heading is always 0,0,-1 (normalized vector heading into the monitor along the z axis)
If you want to move the ship in the direction of the heading you must take the 0,0,-5 vector, rotate it by the same rotation as the ship heading, then add it to the translation. That way you will change the x,y coordinates of the object not just the z coordinate. E.g. don’t always move along the z axis, because unless you are also rotating before your transform that will appear as the object following a straight line, regardless of how the object is oriented.
Draw the movements on a piece of graph paper…
if you have
-z
| b
|
|
| c
|
|
| a
--------------------------+x
and you want the object to travel from a to b, then from b to c,
your translation can’t add just to the z coordinate… you are moving along the +ve x axis as well. You need to rotate the 0,0,-1 vector so that it points toward ‘b’ before adding it to the current translation that got you to point ‘a’. then when you reach point ‘b’ you would need to change the 0,0,-1 vector to point parallel to the line bc before adding it to the current translation.
If you want to keep your translation as holding the world coordinates of the object, you must rotate the velocity vector
that you are adding to the position (translation) vector. It sounds as if you are mixing polar coordinates in with this and getting into a messy chain of translations and rotations