A question regarding raycasting hitbox by swordphin123


I am messing around with raycasting hitbox by swordphin123 and have some questions that i am hoping someone who has some experience with it can answer.


As you will see from the short video I am trying to use this module for things other than weapons. For instance i want to it to detect melee range abilities that don’t have handles and meshes, but instead spawn a block to act as hitbox, but instead of using touched, which is quite unreliable, i want to use this module.
However, in the video above the issue is the number of attachments used to detect. I have 18 attachments and yet if the player is located right in the middle of them he won’t be detected. Which is why i have to tween the part (specifically i tween the weld between it and another part weld constrained to the rootpart).

My questions are:

  • is this a good way to use this module?
  • does having to tween the part to get hit detection negate any performance improvements gained by using this module?
  • does the direction of the attachments affect the direction of the ray? what is the distance? (seems to be 0)
  • is there a way to increase the distance of the rays slightly to compensate for this hole in the middle?
  • Should i be using some other way to achieve what i am trying to do?

Thank you for your time

Welll, you could use it that way but for hitboxes, as you noticed it might not be all that efficient due to the constraints you have found of having to tween it, you might as well use a Region3 to represent the hitbox moreover you won’t need any attachments to setup. Moreover, it is more reliable than .Touched as it uses math as well.

To solve the issue of region3s being unable to represent a shape other than a rectangular thingy you can just use the RotatedRegion3 module which I find to be easy to use. Just create a non-collidable anchored part then use that to represent the region. Moreover, it’ll be easy to debug as well as well it’s from a part.

Hmm, I am not sure. Won’t regions detect all players in the region? that might make it hard to detect the actual target. I would really like to talk with someone who has employed this module in their game.

I just realized, perhaps i can simply use the counterpart to this module, the fastcast module, it specializes in projectiles anyway. I can just make the trajectory really short and achieve the same effect. The only concern might be that there is some unforeseen issue with it