0 votes

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():
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.

in Engine by (52 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.