Add a tutorial for physics-based projectiles

We have a lot of questions WRT doing physics-based (i.e. not hitscan) projectiles:

https://devforum.roblox.com/t/how-should-i-handle-projectile-ammo-to-prevent-server-lag/182440/
https://devforum.roblox.com/t/whats-the-most-efficient-way-to-make-a-slow-moving-projectile-that-can-hit-multiple-people-but-only-once-each/178422
https://devforum.roblox.com/t/best-way-to-handle-slow-projectile/145139
https://devforum.roblox.com/t/slow-projectile-simulation-and-hit-detection/107254
https://devforum.roblox.com/t/what-could-be-causing-lag-in-my-game/95287
https://devforum.roblox.com/t/is-this-a-viable-solution-to-stopping-projectile-lag/94814
https://devforum.roblox.com/t/best-way-to-do-accurate-hit-detection-with-cframed-projectiles/85327
https://devforum.roblox.com/t/collision-detection-for-slow-moving-projectiles/76908
https://devforum.roblox.com/t/projectiles-pre-calc-vs-body-movers/28568

It’s non-obvious how to get these right due to performance concerns, redundancy between constraints / body movers, belief that manual control (i.e. CFrame) is more performant, etc. We should have a tutorial that explains how to make physics-based projectiles properly.

There is:
https://www.robloxdev.com/recipes/Create-Homing-Projectiles
and
https://www.robloxdev.com/code-sample/Projectile-Firing

but both are outdated (body movers are no longer supported) and do an awful (nonexistent) job at explaining why those particular methods of implementation were chosen. For all the reader knows, they were picked at random – these tutorials instill no confidence that the above issues (performance concerns, CFrame, etc) were considered.

22 Likes

image

I think my project will be on hold for a while haha. I should of searched before posting my question, didn’t realise so many people had the same problem.

I ended up just doing ontouch with a table for whitelisting people, I think a more in depth tutorial for it is a really overdue tutorial though. I ended up doing it but the only thing I could tell people for why I did it was “it worked the best for me”. An actual professional going over it would be fantastic.

Also that projectile firing tutorial you listed didn’t even end up going into the hit calculations and what not, it just tells you how to make a brick go from one place to another