How to check, where are nearby objects, what are they and how are they rotated?

I need to check, if there is/are any objects around in 4 basic directions, what are they and how are they rotated. Is there any way to do it simple? Or how to just do it?
Thanks for help, Zvířák. :smiley:

Do you mean objects directly forward, backward, left, and right or do you mean objects near you (like in a circle radius)

I mean directly foward, backward, left and right, I don’t need to check, and don’t want, if something is above or diagonal.
Thanks for your help.

In case all the objects you need to detect have colliders, you might use box collider with limited Y size around the main moving object to detect if they are in range. Depends on what exactly you desire to achieve.
Instead of the box collider you might use Physics.OverlapBox.

Then when all objects are detected, you can compare their transform.position with the main object’s transform.position to find out wheter they are in proper directions.
Or simply you can again use the collider method - use one collider for left to right direction, another one for forward to backward.
To compare rotation of main transform with each object you could use Quaternion’s Dot product but I don’t have Unity here to write and check a sample.

If this is something like chess or 3d terris game where the positions are strictly limited, you might also make track of all objects in 3 dimensional array. Of course if the freedom of movements is large, you cannot go with this approach.