a. GetPartsBoundInBox() in a loop
b. Ripoff of this module
c. Raycasting along the length of the blade
This is for a portfolio piece. If you could provide reasoning why one option may be better or worse than the next it would be greatly appreciated. Thank you! :))
I create an actual Hitbox and then weld it to the character (make it massless to have it not affect the speed) and then use :GetPartsInPart when it reaches a part in an animation with :GetMarkerReachedSignal. It allows an accurate hitbox.
Your best option is option #3, which can also justify option #2 considering it is a crafted solution operating as #3. Ray-casting along the length of the blade offers the most accurate, responsive, and naturally secure hit-detection, plain and simple
@BookDestroyer@Ziffixture In the module posted above it was discussed there and the original writer of the module stated it would basically be comparable to .Touched and wouldn’t be as effective as B. He didn’t provide reasoning though. Any idea as to why he may have said that?
What he is saying is that it is less accurate cause you can swing and miss if the sword is moving fast enough, while his module uses lots of horizontal rays to make sure it hits.
At slow speeds, sure. Generally, you would have to be moving the blade quite fast for its speed to cause issues with hit registration. However, as you increase the detail of the blade, its resulting hit-box would become more convoluted. Furthermore, those hit-boxes would not be able to naturally discern the direction of the swing, so any player to touch the back of the blade accelerating in one direction would be equally damaged despite getting scratched.
Ultimately, ray-casting is much more scalable and naturally supportive of melee hit-detection
it really depends on the shape of the sword so long as it is straight method c is a lot easier and possibly better while the module caters to all shapes of swords
I probably am, but why not get it right the first time?
edit: I do know that option B would be costly because I attempted to make it that way once, and was fine until you hit something where it spiked to 5% script usage, which is probably not super good for performance.