In a 3dgame I am currently developing I am having a bullet
"spawn" from a model resource every time the user shoots with
his/her tank. Let's say that when the game starts the turret is in
position A. The user rotates the turret x degrees and fires, and
the bullet should fly away in the direction the barrel is pointing
in. My problem now is that the bullet always goes in the same
direction. It gets spawned from the tip of the barrel just as it
should, but if I make a 180 degree turn, the bullet flies into the
This is the code for positioning the bullet when it gets
Okay, I solved it by doing the following:
1. Getting a vector from the beginning of the barrel.
2.Getting a vector from the end of the barrel.
3. vector c = vector a - vector b
4. normalized vector c
5. translated the bullet along the direction vector now
aquired (vector c)