Child sprite does not move with grandparent Node2D when parent is node

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

Hi, given a very simple project like so:

    > Node2D_1
        > Node
            > Sprite_1
        > Sprite_2

(Godot 3.1.1)
When Node2D_1 is moved Sprite_2 correctly stays relative to Node2D_1’s position. Sprite_1 however does not and remains in global position.
It appears this is caused by using the basic Node in the tree, if it is changed to a Node2D it works as expected.
So Questions:

  1. Is this expected? If so then why?
  2. Other than changing the node to a Node2D, which seems wasteful (my project has a dynamically created set of layers with many nodes), is there any other fix?

Any help much appreciated.

:bust_in_silhouette: Reply From: jgodfrey
  1. Yes, that’s expected as a child’s transform is always relative to its parent transform - assuming its parent has a transform. Since a Node doesn’t have a transform, there’s nothing for the child to be relative to.

  2. If you need an independent parent with a transform, then yeah, a Node2D is appropriate there.

Okay, thanks for answering. Off I go to switch everything to Node2Ds.

Ratty | 2020-03-11 16:07