What is the best hit detection method for a melee combat system?

I’ve considered raycast hitbox, region3, .touched, normal raycasting
which one of these would be the absoloute best at getting the person the player is trying to hit?

2 Likes

I never heard of raycast hitbox until now. I checked the thread and I didn’t see any issues with it. If you’re comfortable using outside resources, then that’s definitely a viable option. You should be sure to test how well it performs first, just in case.

Region3 might be a bit complicated to use in your situation. I’m sure it can work well with melee combat, but I’ve personally never used it for a combat system.

.Touched is probably the easiest to use, but the .Touched event itself doesn’t fire consistently because it depends on movement. In some cases, you can use :GetTouchingParts() in a loop instead and it should work. Though, depending on how many parts are being collided with at any instant, this might not be the best system to use.

If we’re only dealing with detecting collision with melee weapons, then using raycasting would probably be the best fit for this, maybe with a few adjustments. Raycasting doesn’t use too many resources so you can definitely raycast 60 times per second without any memory issues. Sometimes you may need multiple rays to help the hitbox be more accurate. If you don’t want to write your own system and adjust it to your needs, then it seems like raycast hitbox can do that for you as long as it’s applied correctly.

2 Likes

Last time I tried, I use the GetMouse() to fire an event when when the mouse is clicked.
Then i checked if the Part:IsA(‘Model’) and if it is it just checks for the humanoid, which when found
will be damaged from he server side

1 Like

Hello, thank you for your input. I have found out that Raycast hitbox is really efficient, and is really good. I have ran into some issue with it though.

I get the idea it will cost you performance.
Not so sure though.

1 Like

Yes! I did some more digging and even tried it out myself, i’ve never used a module before so this is the first time. :blush:
I found out that it is very efficient at doing its job, and i decided to use it for my game.
Although, i dont really know how to attatch attatchments to other parts of the body using a tool. Since my combat includes kicking, etc and if i only have the attatchment on one of the fists it only hits once and is pretty innacurate, so i’ll have to find a soloution to that.

1 Like

Raycast hitbox is actually pretty nice performance wise! It seems to be better than .Touched and Region3 which seems like another good point to use RaycastHitbox.

Hey, can you help me solve an issue i just posted?

about the raycast, i’ll look into that.

1 Like

Probably cant help you with the gui stuff, i’m not very good at that stuff. Good luck though.

Image Position isn’t Updating. - Help and Feedback / Scripting Support - DevForum | Roblox

i don’t have the patience to wait for someone to bump into it.

Are you gonna post that reply?

Personally, I’d use an actual seperate hitbox and then follow that up with,

https://developer.roblox.com/en-us/api-reference/function/WorldRoot/GetPartsInPart

If you organize your workspace well, you could handle these very efficiently with the FilterDescendantInstances parameter. An example would be to move all player characters into a specific folder in your workspace and have it filter the rest, or you could also use collision groups to manage your target filters.

1 Like

Hey, can you help me with an issue i just posted?
Image Position isn’t Updating. - Help and Feedback / Scripting Support - DevForum | Roblox

hey, i dont really know anything about the topic so i cant help and i dont have anything to say, sorry.

Ooh, its ok i’ll just have to wait then.

yeah i saw that, i decided that raycasthitbox would be nice’r because it is very easy to set up and pretty lightweight.

Raycast hitboxes, Touched event etc.