lets say you wanna shoot something in the direction of the camera, that thing is going to move 100 studs, so it would be (the camera’s angle)*100 right ? well the problem is, you want this thing to shoot horizontally so you only need the x and z, but if you to (x, 0, z)*100, its not gonna move 100 studs because you didn’t include the y value which is missing for it to be 100 studs
here is a drawing that explains it better
now the player will be in the middle of this, the red dot is where he is looking at, now since as i said, i want to shoot the thing horizontally, i will remove the y axis which will then result in the blue dot, the problem is, depending on how low/high the player is looking, the value that we will get after doing angle*100 is gonna be different everytime, the lower you look, the smaller the value is, and the more horizontal you look, the closer it is to 100.
now, if we use the cross product sleitnick told me about, the result will be the green dot, and the resulted value will always be the same, no matter how low or high you’re looking.