Bullet Tracers?

Godot Version

4.2.2

Question

I have raycast “histscan” weapons in my game. I’ve been trying to figure out a clean and efficient way to make good looking bullet tracers, like the these.

People have suggested making each bullet a characterbody3D and deleting it when it touches something, but that would involve the physics server which seems really expensive for nothing. Unity seems to do this via particles, but I haven’t found a way to wrangle the GPU Particle 3D node for this. It seems to only be for chaotic particle effects.

Do you want the tracer to travel, or do you just want a line to appear for the hitscan?

Travel like in the vid would be ideal.

Gotcha. Well it certainly doesn’t need to be a particle. Since you’re already doing a hitscan, that gives you a start point and an end point. You just need a good-looking Node3D of some sort to lerp move between the two. Oh actually not lerp, since you want to move it at a uniform speed, but you get the idea. Probably a MeshInstance3D will service just fine with the right shape and coloring, or even just a quad with a shader. Create it at the gun, move it to the endpoint, the free it. If it becomes a performance issue then create a pool and recycle them.

1 Like

I see. How do you accomplish the effect where the tail end of it always stays connected to where it was shot from?

By making it really long is one way. The vid you linked they actually don’t seem to stay connected to where they were shot from. I think they’re just long and fast enough you don’t notice.

If that were the case, the tail end would appear behind the player shooting it. That doesn’t happen in games. I think what it does is it stays attached, stretches to the final position, then the tail end retracts until it too reaches the final position.

Ah, so this is multiplayer and you’re concerned about it from other players’ perspectives then? That changes things, if that’s the case.

2 Likes