I’m attempting to make a “bullet trail” (that’s just a red line that follows my bullet object) but I’m unsure on how to do this. Basically, I have a bullet mesh that is created in front of the player on click and then is moved by setting it’s bulletRigidBody’s velocity (so it’s fired like a regular bullet). Since, it moves so fast, I want to draw a line that follows the bullet’s path until it stops. How can I do this?
I’m unfamiliar with drawing lines in OpenGL, but I thought the process would be something along these lines:
*When bullet is created, start line at its world position
*Each frame, as the bullet moves, extend line to new world position
*Set the line to a certain length so that it doesn’t end up too long
*When bullet stops moving, delete the line
How would I go about this with regards to code? Thanks.
Here’s an example of what I want to achieve: https://www.youtube.com/watch?v=Wm6Q7a3ThTY&t=60s