# How to display an area around the player

Hi !

I would like to display an area around the player according to the distance the player can cover.
I also want it to be modified by obstacles.

How can I compute it ? and how can I display it ?

See my beautiful MS Paint drawing

You are looking for a some complex areas calculation.

If i have a problem like this, i think i could do this:

“shot” from the player a Raycast to 8 or 12, 15 or 24 directions (for example to 0º, 15º, 30º, 45º…345º). And check if the raycast hits something before arriving to max player range. If hits somethig or arrives at the maxrange, create a invisible point there, lets say its called Point1. The same for all the raycasts, so in our examplke we have 24 points. Now just connect the points 1 to 2, to 3, to 4… ,to 24, to 1. This way you will have a 24 siided polygon with detect objects arround the center (player).

Bye !

Hi !

This is a great idea but I need to know if the player can go on after going around an obstacle and display it.
Let 's say the player can walk 10units, it takes 5 to go to the obstacle, then the player can go behind it.
I would like the player to know he can still walk after reaching the obstacle.

I know this is complex without a grid but I want to keep the flexibility of choosing the move precisely without grid constraints

Hi !

I used @tormentoarmagedoom 's method. But I have some issues with the collider detection…

The area (the grayish brown part) is supposed to go around the obstacle but some of the rays go through it.

• The circle at the top of the screenshot is the player

• The camera is orthographic from the top, so no perspective is involved.

• my collider :

• is a simple box collider

• is static

• has a rigidbody (all position and rotaion frozen)

• the collision detection is continous (I tried all type and
nothing changed)

• Interpolate is None (I tried all types and nothing changed)

• The raycast is a simple raycast from Physics.Raycast(Vector3,Ray, out RaycastHit)

• There are 360 rays all around the player.