How to attach an object to the body?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Roket

I have a player, I want to implement taking object from map

Initially, the object is the children of TileMap, but when I take it I try to swap the parent for this object on Player.

if obj.get_parent():
		obj.get_parent().remove_child(obj)
	add_child(obj)
print("obj = ", obj.get_path())
# out is: /root/World/Players/1/PlayerEquipment/M4  - its right

But object just staying on the player’s starting position, but I want to moving this object together with player.
What is the best way to implement such a feature?

At start I had a different idea:
I tried save owner for every objects and changing they position in _physic_process(), but I thinking it is not right and I can lose performance.