Which route to go for melee hitboxes?

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! :))

1 Like

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.

the point of the three options is that it works for super slow attacks

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

1 Like

I think c would probably be the best, you can change it’s frequency freely to change accuracy to performance ratio.

@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.

You could probably make the rate of the ray proportionate to the speed of the weapon.

Or just be super careful and slap it in a RenderStepped

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

Thats one of those things you can call a “feature” though.

Oh shoot I didn’t think about that! A scythe or scimitar would be pretty wack.

In virtually every circumstance, a player-base would deem it inaccurate hit detection

I agree. Maybe I should make it toggle-able? Sacrifice performance for accuracy or the other way around.

edit: nvm other players wouldnt like that

I think players generally prefer accuracy over performance

edit: to an extent

More controllers are broken over inaccurate hit detection than lag.

The ray-casts used in your melee detection would have virtually no impact on performance; you’re overthinking this

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.