PathFollow3D won't change parents

Godot Version

4.3

Question

So I got a nice PathFollow3D with a mesh following a Path3D. I also have a second path3D. I want the PathFollow3D node to change to the second Path3D, sorta like a train changing tracks.

Method #1
I used remove_child to remove the follow node and then I used add_child to place it on the second. That works…except the PathFollow3D is still present on the first path travelling along on its merry way. It’s also on the second path, where I want it.

Method #2
I used queue_free, but the follower is still travelling on the first path, and it never showed up on the second path, which is what I expected but it no longer supposed to exist.

Method #3
I used node.reparent. That works…except the PathFollow3D is still present on the first path just like method #1. It’s also on the second path, where I want it.

So as I stated, I have a FollowPath3D which is on a main path but it can branch off to several different paths. I would like it to reparent to whatever path I chose it should take. I really don’t want to lay several paths over top of each other, I rather just jump to different branchs.

Any suggestioons out there?

1 Like

Hey, I have a very similar problem, did you figure it out?

One Idea I had to work around this issue was having one follower for each different path, and making it so the node I want to follow the path just copy the position of the follower, so that when tracks are switched, I only need to switch the reference to the follower the Node is using.

I just haven’t figured what would be the optimal solution

I’m making a train game and I’ve not had any issues using reparent to switch PathFollow3D to a different Path3D.

The PathFollow3D has a child RemoteTransform3D that points at a top level RigidBody3D that is also a child of the PathFollow3D. The mesh is a child of the RigidBody3D.

This and Godot are my first attempt at game dev, so my setup might be working by coincidence rather than design, but it is working!

You might have to share a video of the issue, your node tree, any code etc for someone to be able to help.