- Home /
How do I check is there any room on any of my current room position.
Basically, i have different room design set as a level prefab. In a scene, i instantiate different room design randomly on a pre-set spawn point. Here's the question, for each room there's door for player to move in and out, how do I check is there any room on any of my current room position, so I can transform the character to another room.how to check if there's a room on the right, on trigger when player collides the door transform to the room on the right
Answer by Dudicus · Jul 11, 2017 at 02:12 AM
This is kind of unclear. to me. But try raycasting.
Yeah you could raycast but really you should have all this information by the time instantiation is done without using physics. You need to consider keeping tighter track of the architecture of this game if the solution is not immediately clear.
The spawn points are pre-set. You know which spawn points are next to other other spawn points.. the game should know that too.
Answer by springwater · Jul 11, 2017 at 05:47 AM
You could tag your room and on trigger enter the door, see if any room tagged is the proper distance to possible locations in the trigger, if it matches, you will know.