Path2D/Pathfollow2D as child of YSort

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Eric Ellingson

I have an entity that needs to follow a path, and so I have my level tree as follow:

> Node2D
  > YSort
    > Player
    > OtherNode
    > AnotherNode
    > Path2D
      > PathFollow2D
        > Sprite

where the PathFollow2D is the root node of another scene that holds all the nodes for a certain entity, and has been instanced as a child of Path2D. However, this doesn’t seem to play well with the YSort. What I would like is for it to act as if it was just another node/entity nested under YSort, but just have it follow a certain path.

:bust_in_silhouette: Reply From: Eric Ellingson

The solution to this was to use the RemoteTransform2D node.

The scene tree ended up as follows:

> Node2D
  > YSort
    > Player
    > OtherNode
    > AnotherNode
    > Sprite
  > Path2D
    > PathFollow2D
      > RemoteTransform2D

Where the remote_path property of the RemoteTransform2D is set to the Sprite node.