How to Make an Entity Follow a Path Between Multiple Scenes With Only Path3D Nodes?

Godot 4.4

Hello, I am making a game that generates a set number of rooms, each being their own instanced scene, from an array defined in the main scene. Here is the code for room generation in the main script for reference:

var rooms = {
	1: load("res://Scenes/Main/Rooms/hallwayroom_1.tscn"),
}

var last_room 
var endpoint

func _ready():
	generate_rooms()

func generate_rooms():
	last_room = $entranceroom
	for i in range(1,50):
		var newroom_instance = rooms[randi_range(1, 1)].instantiate()
		endpoint = last_room.find_child("End").get_global_position()
		get_tree().get_root().add_child(newroom_instance)
		newroom_instance.global_position = endpoint
		last_room = newroom_instance

I have plans to eventually add an entity that moves along a set path that is included in each room generated, similar to Rush’s behavior in DOORS, where it basically moves on a rail through multiple rooms. The monster will be instanced in the main scene. Assuming the Path3D/Path3DFollow nodes in each room scene use the same start/end coordinates as the start/end markers that indicate where the rooms generate, how would I go about coding the monster so it follows the path through all of the rooms generated in the main scene?

You can either :

  • make the monster switch from one Path3D to the next when the current Path3D ends
  • re-create procedurally a new Path3D that will be composed of all the Path3Ds.

No experience with the latter though, I don’t know if it’s possible (but I guess so)

I was intending on trying to achieve the former anyway. My only stump is that I am still confused on how to accomplish the monster:

  1. Following along the Path3D Node when the monster is instanced from one scene while the scene containing the Path3D Node is instanced from another scene
  2. Make a smooth transition between each Path3D Node

It seems like only children of the Path3D node can follow it, making it tricky to try to constantly reparent the monster to each new Pathway, but I want to refrain from using NavigationMeshes since I only desire the aforementioned “on-rails” movement for it with occasional sharp 90-degree turns at most. Assuming the entity uses the most basic movement, which is something along the lines of:

func _process(delta):
progress += 1 * delta 

How would I go about accomplishing the two criteria listed?