I am faced with a programming objective to which I am having trouble thinking of an efficient method to solve. I would appreciate any help/suggestions.
Problem: An object (let’s pretend it’s a vacuum) sucks in players when they get within a certain range of the vacuum. How do I calculate if the player is close enough to be sucked in?
- Use a continuous loop and a region3 surrounding the vacuum to check. (very resource intensive though…)
- Get a list of all the players and continuously check if the vector3 distance between each one and the vacuum is short enough (also requires checking for new players then)
- Create an invisible part around the vacuum and perform the suction onTouch (onTouch is unreliable though)