I am working on a game that has instanced objects spawning rigidbody3D(eggs) from a node3D(nest_manager), after it spawns 5 eggs and groups them in "eggs". I want the player to be able to pick up the egg from the nest and hold it over their head as they run around before depositing it in a bin. I have an Area3d and collisionshape3d to detect when the player is within range on the eggs and then the player can "use" to get a single egg.
The problem is arising when I'm removing the parent from the egg and trying to add it as the player's child I keep getting a hard crash with player.gd: @ pick_up_egg(): can't add child 'player' to itself. As well as Condition '!is_inside_tree()' is true. returning: Transform3D().
I don't see any recursive code, but I'm very new to this.
My game is set up as a node(main) with both the nest_manager and player instantiated into it. is it something that I should have just made them as children of main? instead of their own scenes?
I've included the bulk of the pickup code where the error is getting called out.
Any help is appreciated or if you have ideas on an easier way to do this I'm all ears!