I have a player-controlled object that I am moving around an arena type area. What I want to do is to move the player near an object, and on a particular keypress I would like to display a circular radius around the player object with it being in the exact center that will detect nearby objects (preferably filtered by tag).
I realize there are many ways to accomplish this, but being new to Unity I am trying to find a way that is relatively intuitive to me. Looking at the documentation, Physics2D.CircleCastAll seems like it would fit my needs, but I am unable to test at this time (at work).
A few questions:
-
Is there a way to colorize the circle that is cast by Physics2D so that it is visible in the scene for testing?
-
I assume that the return type RaycastHit2D[ ] of Physics2D.CircleCastAll s the location of the collision. Using that am I able to get the exact object that was involved in the collision?
-
Would there be a better solution to CircleCastAll that would accomplish my needs in a different way?
Any suggesions/tips are welcome. Please don’t give me the code, as I’d like to figure out most of it myself. Thanks in advance!