Best way to do projectile hit detection?

I don’t really use touched in general, but from what I heard, it’s not used physics aren’t too accurate (they run on a specific interval and if the server/client lags for whatever reason, it might not work too well).
The two other common methods I’ve heard were:

  1. Raycasting
    For slow/noninstant projectiles: Cast a ray starting from the part’s last position to its current position.
    For instant projectiles: a single raycast in the direction of the projectile.

Pros:

  • VERY fast

Cons

  1. Shapecast (sphere/blockcast) Introducing Shapecasts
    This is a raycast, but instead a 3d object. I personally don’t use these, because I prefer using the next the next method.

  2. GetPartsInBounds (or if you want GetPartsInPart)
    This lets you find whatever is inside a 3d region.

Pros:

  • Supports getting multiple objects
  • Much more accurate than using multiple raycasts

Cons

  • Uses more performance

That’s all I know. Hope it helps!

2 Likes