Actually very simple! In the object properties go to the Line of Sight behavior propeties. Change the Obstacles from Solids to Custom. Then Add Action > your object > Add Obstacle > the object you want it to collide with.
Then just do that for every object you want the raycast to collide with. (you could also add all those objects to a family and add that family as an obstacle) :)