Godot Version
godot4
Question
i have a world node and its children are gun and player.
I want to make the gun a child of the player.
how do i do this
godot4
i have a world node and its children are gun and player.
I want to make the gun a child of the player.
how do i do this
Just drag it onto the player node in the editor.
sry, i mean in code
Do you have bing?
I just type this in the editor:
godot code to move a node from one parent to another
bing gives the code:
func move_to_selected(node, old_parent):
old_parent.remove_child(node)
selected_node.add_child(node)
node.set_owner(selected_node)
thnx that worked. also, wdym i have bing? I dont have it
bing is the search engine for Microsoft Edge.
i see, so ur saying you found that with bing?
you can also use reparent
node.reparent(new_parent)
Yeah, try it out. It’s really handy. Just type “godot code for …”
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.