Basically i’m doing my own custom procedural dungeon generation I have the rooms being generated correctly but now I need to create hallways that will link the rooms together and the way I thought of doing it is as diagrammed below.
Rayscast only hit Colliders, you need your room generator script use the room position to calculate the intersection point.
Example:
Vector2 roomA; //set with Room A position
Vector2 roomB; //set with Room B position
Vector2 IntersectionA=new Vector2(roomA.x, roomB.y);
Vector2 IntersectionB=new Vector2(roomB.x, roomA.y);