Error in the output:

ERROR: This function can't be used during the in/out signal.
   at: (scene/3d/area.cpp:196)
ERROR: FATAL: Index p_index = 0 is out of bounds (((Vector<T> *)(this))->_cowdata.size() = 0).
   at: operator[] (./core/vector.h:49)

[process exited with code 3221225501 (0xc000001d)]

I am trying to create a moving platform for my game. I get an error when entering the area of the platform (The way I am trying to manage not sliding off is by reparenting the player. Here is the code for that (which I believe is causing it)

func _on_PlayerArea_area_entered(area):
	if area.is_in_group("Platform"):
		get_parent().remove_child(self)
		area.get_parent().add_child(self)


func _on_PlayerArea_area_exited(area):
	if area.is_in_group("Platform"):
		get_parent().remove_child(self)
		get_node("./Characters").add_child(self)

(This is in the player script

  • I think you have to move the platform with the AnimationPlayer and set the Physics Sync to On. I can't find the project, but I'm sure I got it working at one point.

No, that's not going to work. When you remove a node, it is basically in a suspended state (like it is paused or frozen) so nodes should not remove themselves. You should just work on the physics. Moving platforms can work fine, without and reparenting, let me see if I can find one of my example projects.

I think you have to move the platform with the AnimationPlayer and set the Physics Sync to On. I can't find the project, but I'm sure I got it working at one point.

    5 days later