Why use ray trace in weapons?

I was going through shootergame example and I find out that the weapons use ray-tracing however I couldn’t understand why was this done?

If the player possesed a truly instant hit weapon e.g a laser or lightning gun then its obvious, but why use line tracing with a gun which fires relatively low speed projectiles? bullets may not hit instantaneously over large distance.

Also with weapons firing even slower projectile like the rocket launcher, what is the purpose of raytracing? shouldn’t all hit calculations must be done on the actual projectile when it collides with other actor?

I do understand what the ray trace function does but I don’t get its use in weapons.

Can somebody please clarify?

Did they really do line/ray trace on slow projectile weapons? I thought the Shooter Game only has two weapons, both with bullets that instant hit.

If you have a slow moving projectile, then you will use the overlap event of a box.

Even normal ballistic weapons are implemented using instant hits, this makes the code much easier and is more accurate in multiplayer games. Apart from that it is far simpler to just do an instant hit then spawning a projectile and simulating it, just thing about a game with 16 players and automatic weapons, using instant hits you will save a lot of bandwidth.

But yes, for rockets you shouldn’t use ray tracing and just spawn the rocket which flies and hist using normal collisions detection.