Best method to detect touch for extremely large parts?

Recently, I have been reading on the various methods to detect touch (region3, gettouchingparts, raycasting, touched event). However, many of the forum posts talked about detecting touch for hit boxes, which are small and thus would warrant more precise and faster detection. In contrast, I am seeking a method that is most performant but still effective at detecting touch with large rectangular parts with a width of at least 30 - 40 studs.

Another question that I have is: what is the difference between the touched event and :gettouchingparts()?

Thanks for your help!

1 Like

Are you using this for detecting when a player is in a certain area?
If you are; I recommend this really neat Zone+ module.

It has covered all the methods that you just mentioned and explain why and why not to use them; and finally decided on a holy grail, which is Region3 + Raycasting.

Check it out!

To answer your question; think of it this way.
:GetTouchingParts() returns all parts the part is physically touching.
image
One way that you can utilize this is if you want to make checks from time to time. But if you’re trying to detect when a player entered the part; this isn’t for you.
I mean, you can still use it but it’ll be very expensive and you’ll have to run the event all the time. So using the touched event is better.

However, for touched; it’ll only connect WHEN the touch started or ended. So if the part is already inside the part in the first place, the event won’t run. Nothing will happen.
image

The Touched event will fire everytime the part comes in contact with something. This is most preferable if you’re waiting for the part to come in contact with another part.

5 Likes

I’ve read the Zone+ module that you’ve recommended me. It’s truly an ingenious way of detection that I am surprised has not been the convention. It is definitely the one I am looking for. I guess I couldn’t find this article sooner because what I searched for was technically not a zone, but it is still the same idea. Thanks for you help!

Regarding the touched event and the :GetTouchingParts, I think your explanation has helped clear things up. I agree that touched event is definitely the best for performance since it is an event, but it is still not that efficient and has errors during detection. I have seen some people use :GetTouchingParts which gave me the impression that it performed better than Region3, but that may just be me.

Thanks for your help, you’ve helped clear everything up!

1 Like