i’m using shapecasts for my fighting game, but i’m not sure if i should go back to using normal rays, or some other type of collision, as it feels pretty inconsistent when i correctly hit something.
Have you used part:GetPartsInBox()? Using rays for most fighting cases aren’t satisfactory, only when using ranged weapons are rays applicable.
What the function aforementioned does is simply takes a hitbox (of lets say a fist) and finds everything that’s inside of it (you can exclude the original player) and makes a little table. From there, you can loop through that table and do whatever is necessary to certain parts.
part.Touched is great and all but heavily inconsistent and not to mention inefficient.
yeah, i used .Touched when i was new to roblox studio and then learned it was heavily exploitable so i moved to rays, getpartsinbox seems pretty complex so i never really tried it (ive only been developing for about 4.5 months) but i’ll try that out.
this ended up working really well, thanks for the help.
The answer you’ve got is already satisfactory, but for future reference I’d like to point you to this info which might explain the inconsistencies you’ve seen with shapecast.
WorldRoot.Spherecast’s documentation has this to say (same with Blockcast):
Unlike WorldRoot:GetPartsInPart(), this method does not detect BaseParts that initially intersect the shape.
If you collided with something that’s already intersecting with the origin sphere/block of your shapecast, you’d need to also use GetPartsInPart
or GetPartsInRadius
separately to detect those.