In this section, we will add another object to our scene, the bullet (Bullet.json
), and we will move our bullet in a straight line, unlike Angelina Jolie's movie Wanted, where the guys curve bullets. We can do that by applying B-spline interpolation but we are still medieval and we will save it for our grenade.
The equation to move the bullet is simple: f(x)=z. We will simply change the z value to move the bullet. However, this is awful because if we rotate ourselves (the camera and subsequently, our arm), the bullet should go in the arm's direction. To achieve this, we need to apply the camera transformation to the bullet. Each bullet will have the same defined set of points, let's say (0,0,1),(0,0,2)...(0,0,200), but when we apply these translations to the clone of the camera matrix, then each time we fire the bullet from a different angle or position, we will get different trajectories. Actually, these defined positions are with respect to the camera...