Is there a move_to_back()?

Godot Version

4.4.1.stable

Question

I want to know if there is a move_to_back() function. I couldn’t find one. But I want to move a body to the top of the tree (meaning it is shown in the back) and I don’t want to be using Z Index for this. Just like move_to_front() but opposite. Thanks!

Don’t think there is an easier way, you can use get_parent().move_child(self, 0) though.

2 Likes

Thank you.

Out of interest, why wouldn’t you want to use the Z index for this. That is what its there for after all.

1 Like

That is a good question.

I want every new body spawned as a child of a certain node to be spawned behind all its siblings without messing with it’s index relative to other nodes. (There will be hundreds spawned)

You almost certainly will run into problems then as moving nodes around a tree is not performative in any way. Because if you are moving something to the top of the tree , you are moving everything down.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.