How to how to change a child's orientation in a node.

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

Good Day All programmers and the like. I have a seemingly simple yet difficult question. I Just finished making a weapon wheel and long story short a function was used in order to add the gun, it makes an instance that is a child of another node (the fist). Problem is when it adds it to the fist as a child its added at the bottom of the node below the sprite for the fist. Godot apparently uses an orientation as when I use get_child() I have to add a number depending on its orientation E.g $Fist.get_child(0) or $Fist.get_child(5) etc. , the gun node is spawned in as the new child in (The Fist) node and the gun it self is shown over the hands looking awful. Do any of you know if there is anyway to change its orientation Remotely in game. Thank You in Advance

:bust_in_silhouette: Reply From: dewcked

You don’t have to change the orientation of childs. You Just need to change the z_index of the Sprites.

Z index. Controls the order in which the nodes render. A node with a higher Z index will display in front of others. Must be between VisualServer.CANVAS_ITEM_Z_MIN and VisualServer.CANVAS_ITEM_Z_MAX (inclusive).

Thank you so much this fixes a lot of problems. There are now so much ways I can implement this.

KLDGZ | 2021-11-25 13:55