|Topic was automatically imported from the old Question2Answer platform.
i’ve got a playerscene that i imported into my map. The player contains of an position 3d, a Camera and a collisionshape.
now im triying to parent an object in this map via the script of the player to the players position 3d. i tried it like so:
var new_parent = get_node("Area/Position3D")
get_parent().remove_child("object of map")
new_parent.add_child("object of other world")
but this doesnt work, and i think its because the object is in another scene.
has someone an idea?
(sorry for my bad english)
If this “another scene” is not part of the sceneTree then your attempt is not possible
If your intention is to move a node between changed scenes then your best option would be to save it to a var possibly in an Autoloaded node then add after scene change
Assuming that is not the case and your node has been properly added to the sceneTree then it’s simply a matter of referencing the proper nodePath, look in the remote dock on game launch to find that out.
Your node must be instanced to be added so even if temporarily load that PackedScene then add to the sceneTree where needed
Nice, now it works.
theMX89 | 2021-07-06 15:32