Checking distance or using touched/overlapparams?

I’m attempting to make a system for cutting trees, getting water, and other interactable stuff and I wanted to know what’s the best way to check if the player is near one of these things. The 2 methods I thought about are

a) Constantly check the distance
b) Using .touched or preferably overlap params and have invisible triggers setup and tag them using collections service

I feel like method b is the better option, but not sure.

There is no better or worse solution here. You have to ask yourself what fits better to the game itself.
If you want to consider optimization, I guess detecting collisions is a better approach, but sometimes dealing with collisions is not as easy as dealing with distance (You have much less control over the collisions, whereas with distance you can easily modify it to different game mechanics). So, just choose which one you think would be better for this specific scenario.

Why do you check repeatedly? why dont you check when you want,such as cutting trees,you can check that when player click to cut tree then you check distance with .Magnitude and if it is near,you cut tree else dont cut tree

1 Like