Hello! I'm making a 3D game about burgers where I have the Ingredients (like bread, burger, cheese, etc.) that are RigidBodies and can be stacked up on top of a Tray (so you have to put the ingredients on the right order, but this is not important for this question).
I have an Area node inside the Tray that detects when an Ingredient intersects with the Tray, and when it does, it executes the following code:
func _on_Area_body_entered(body):
if body is Ingredient: # Ingredient is inhereted from RigidBody
body.get_parent().remove_child(body)
$Ingredients.add_child(body) # Node that serves as a container for ingredients
body.mode = RigidBody.MODE_STATIC
...and then I get a stack overflow error.