Hello! I am currently working on a projectile system for my guns.
But there is a problem! While most games simply raycast for the bullet, this does not work super well in Roblox due to the unprecedented amount of mobility that a Roblox player has. The player can run around and jump, most of the bullets will miss. I cannot reduce this mobility either due to the type of game, size of the map and setting.
My solution to this problem was to add volume to the bullets, like so:
The system only ever uses a singular part for the collision detection, resized and CFrame for each following cast along the arc. The red parts in the gif above are added to visualize what the system is doing.
My main concern is that doing so much detection for each bullet (times 8-16ish players per server) will not run too well. There is also the issue that for reliable wall detection (so players are not hit when standing behind a wall), the parts found with getPartsInPart() need to be ordered by distance. This is done in the program by simply comparing distances for each part from the point of casting. This works fine enough for objects directly in the projectile’s path, but for a large wall whose origin is far from the casting point, it may be calculated as behind the player when this is not actually the case. It would be better if they were simply ordered by point of collision, which raycasting does more effectively.
Am I overthinking this, or is there a better solution?