I am attempting to create a hitbox system that can detect where on a players character the hitbox has hit (or roughly where it should based on the attacking players attack)
I am making a battlegrounds game style M1 system and am trying to apply decals roughly where they get hit, and use it for the knockback as well to make it feel right.
I can’t quite figure it out, but I feel like I’m close. my hitboxes detect hits great, I feel like I need to use raycasts inside of the hitbox to get the position of the hit, though multiple raycasts can return hits.
I’m quite confused as to how I would do this, I just need a direction and a position from it. Do I need to switch over to raycast hitbox for M1’s? I need parts for other abilities with AOE and things I’m assuming but should I use my normal hitbox plus a separate Raycast one for hit position detection, and make it accurate to the players animations and things?
If is a battlegrounds game or melee game have the player’s swing animation play then create a part in front of the character the size you want the hit box to be, do workspace:PartsInPart(hitbox) to find all parts in hitbox then instantly destroy it.
You need to use some CFrame logic to get the part in front of the player no matter the angle
I agree with this however, you should use GetPartBoundInBox. Creating parts just to destroy them immediately after is pretty unnecessary and should be avoided. Optionally you could have a premade hitbox on the weapon in which case using GetPartsInPart should be used
I completely forgot about that, that is certainly a better idea.
Also to add on to what I was saying before about adding hitbox, you want the swing animation to be really fast and way faster than you would normally think so that the hitbox detecting would look good.
This is what I’m doing currently, I can detect a hit no problem. I was just wondering if there is a way to get a rough hit position to position a decal or a part with vfx at to make it seem a bit more dynamic.
This would be better, though my current hitbox setup is simple and I like it. I am just using a part with a WeldConstraint to offset it in front of the player and using GetPartsInPart()