Path3DSquare which is basically a rectangle shaped loop
Path3DDetour which starts somewhere along Path3DSquare, takes a detour and rejoins Path3DSquare at a later stage
Now I want my mesh to move along Path3DSquare and once it reaches the point where Path3DDetour starts, move along Path3DDetour until the end and then continue moving along Path3DSquare again.
For the first part my idea was to use some kind of collision area to detect once the mesh is close to the the exit and then change the PathFollow3D for the mesh.
If the mesh joins Path3DSquare again, I need to change the PathFollow3D to be a child of Path3DSquarehow but how can I tell what the correct progress ratio for the PathFollow3D would be to make sure it continues at the correct coordinate?
Right now I am not even sure if that whole approach makes sense or if there are better ways of solving this.
You should be able to use get_closest_offset on the Curve3D of the Path3D.
You can use the position of the last point of the Path3DDetour to figure out the offset on Path3DSquare.
If you know how far along the path the mesh is moving each frame, you can check if it’s current offset + movement will put it past the end of Path3DDetour. If it is you can move it to Path3DSquare and sets its progress to the offset given by the last point plus the extra it should have moved.
For example:
If Path3DDetour length was 100.
The offset at the end of Path3DDetour on Path3DSquare was 42.
If the mesh moves 10 per frame and was current at 96, then you’d move to Path3DSquare and set the progress to 48.