Hi all. I made top town 2d game. when room start, or when player die i need find random free position for player. where is red collision polygon, there is not free place. Also player has too collision, so when I find random position, then player collision circle also cant collide with red polygon how I can do some like this? Thanks
You could generate a position slightly above the map randomly with a random valid rotation, then perform a Rigidbody.SweepTest() straight down to the floor to see if there are any blocking colliders. If there isn't, use that spot. If there is, generate a new position/rotation. Not the most efficient in all situations, but it's an OK method all-around.