I’ve used magnitude, tried touched, but i’m not getting what I want. Magnitude isn’t the right shape for combat from what I see. I want to know how I can use a square hitbox, but be able to rotate it depending on the face of the player.
For combat? I would highly recommend using something like this:
instead of sticking to a block shape (XY problem anyone?).
However, if you legitimately need a square hitbox for whatever reason, try RotatedRegion3:
It lets you specify a region using CFrame and size, and you can make sphere hitboxes, wedge hitboxes, cylinder hitboxes etc. Additionally, it allows you to get points of contact too.
What if what i’m making is fist combat? I can’t just plop attachments called DmgPoint into that, because attachments effect character physics my player would be glitchy.
Attachments that don’t have anything connected shouldn’t do anything… If parenting an Attachment instance to a character limb changes the physics, would you mind filing a bug report on that?
For area hit detection I’ve tried rotated Region3, but in my experience touched is more reliable (not sure about performance, however). Just spawn in an invisible, non cancollide part and use GetTouchingParts
. You can do this without yielding:
For melee hit detection, I’ve seen the best results by far with raycasting.
Creator of that Raycast hitbox module here. What @anon66957764 said is correct, attachments by itself do not cause any physics interference. There have been a few developers that already uses it for fist combats.
If you still are not keen on using attachments, the module also offers a vector based alternative that doesn’t use attachments to spawn raycast points. It is not listed on the main post since it’s more for the advanced users. You will just need to look in the thread and its API documentation.
I’m using the raycast hitbox module made by @TeamSwordphin and you can definitely use this module for fist combat with-and without the attachments. At first, I spawned in attachments named DmgPoints into both fists, but eventually decided to move over to the vector based alternative, which works a lot better for what I’m trying to achieve with my fist combat system. Here’s an example of what that looks like:
https://gyazo.com/4fb273a9623c428825a7f32563836b6c.gif
As you see in my example, you can use it for things like your feet and legs as well. This module is really versatile and you can use it in any kind of melee combat scenario