
Sublime wrote: >>I have a 3D object located at a specific point (x, y, z). The object is a space ship and when I want it to shoot, I animate a laser going into the screen along the zaxis. >> >>But if I rotate the ship by some angle and it should shoot towards the left instead of straight in, what equations do I need to find the new x, y and z coordinates? >> >> >>Thanks! >> I'm not sure what you mean by the 'new x, y, and z coords' but would this work? With the space ship store 3 vectors that represent the ship's x, y, and z axis. At the start these would be x[1,0, 0] y[0,1,0] z[0,0,1]. Each time you rotate your ship, rotate each of these 3 vectors in exactly the same way. And when you have to shoot a laser, the z axis you stored would be the direction it would have to go.
So if you were going to move the laser forward by 1, you'd translate it by the x, y, z components of the z axis you stored.
if you were going to move the laser forward by 0.1 or (1/10) you'd translate the laser by the x/10, y/10, z/10 components of the z axis. (But make sure you preserve the original values before dividing by 10)
