Raycasting To Objects

I have this array of all objects in the world(GameObject allObjects), what I need to do is fire a ray at each object from my players position in order to see if said object is behind another one. the origin is simple, its just transform.position(script attached to player cam), but the rotation is very difficult for me to get my head around.

Thanks for the help in advance.

By rotation, I’m assuming you mean direction to the other object?

This is a simple thing to find. Direction vectors can be calculated by taking the ‘from’ position, and subtracting the ‘to’ position. So for each object in your array:

var directionVector = transform.position - other.transform.position;