# Ideas on how to do this pathfinding?

Hello, I have been developing this game for quite some time now and I have been trying real hard to avoid this pathfinding, but now I must complete it in order to finish my game (almost done, so excited!). First, a diagram:

Let me explain real quick, each brown square is a door. The symbol above each door points to where the door will lead to. What / how do I get my AI from Room 1 to Room 4? I have no idea how to do this kind of pathfinding because I have never done anything similar.

Let’s please discuss this together so we can decide on how to approach this cryptic problem. Thanks for your time!

This is a simple waypoint network problem. You build a graph representing your world - each node is a room and each arc is a door - and then use an algorithm like A* to work out which rooms/doors you move through to get from A to B.

Yep, A* is probably the way to go. There are faster methods, but unless your game has a network of 45,000 rooms that need to be pathed through, you should be fine.

Hmm, ok. So this will work if I only want the enemy to be at X = 5 constantly? And how would the teleportation work? When the AI hits the door, he would teleport to the other one, but he will also hit that other door and it will teleport him back.

If you are teleporting you do not need pathfinding. You simply need to translate the transform position coordinates when triggering that portal to the new door and set the rotations according to the door rotation that he should be facing when teleported under conditions you create in if and else if statements. If that destination door has a trigger you may need to temporarily switch it off so he is not re-teleported.