0 votes

Typically when you move a parent it's children move along with it. I want to be able to move a child and have its parents move (up to a point, don't want to move root or the viewport). Is there a way to do this? Should I switch the child/parent role and then switch back, does that cause any weirdness/data loss?

in Engine by (684 points)

1 Answer

0 votes
Best answer

This works perfect! Avoids all messy/dumb reparenting stuff and works no matter how many parenting layers are between parent and child

var diff = get_global_pos() - my_child.get_global_pos()
set_global_pos(other_node.get_global_pos() + diff)
by (684 points)

This doesn't work for me.

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.