-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reparent node, maintaining transform #4008
Comments
Related to issue #2284, which is about an option for the editor. |
@kirilledelman ~ I guess it would be hard to not call |
@bojidar-bg the other issue is already solved, but it's just an editor option :P |
@neikeq ~ whoops, did't notice it is closed... And about editor options... 😉 |
If it's a pain to prevent _enter_tree and _exit_tree let's omit it, but |
Why close? This is still not done, and a nice function to do it wouldn't harm |
Well I thought about it, and realized that without |
I feel there is still a need for this function. In my game I want to have multiple rooms that are dynamically loaded and ran at runtime and the player can transition through them in an 'open world' (no loading screens) manner. While using the following code if functional, there is a noticeable flicker as the player being moved is first placed locally and then the position is fixed globally. |
I would like to request a method added to CanvasItem object:
CanvasItem.reparent( new_parent, keep_world_transform=false )
The method would un-parent node from its current parent, and add itself as child to
new_parent
. Ifkeep_world_transform
is true, it would maintain its transform relative to scene root ( soget_global_transform()
before the call and after would return the same transform ). After this call, withkeep_world_transform
true, the node would not appear to move, but switch parent.Additionally, this method would NOT call
_exit_tree
or_enter_tree
methods unless new_parent is not part of display tree.I suspect it could be a pretty easy thing to add to engine itself, and kind of a pain to do in GD Script.
As an example, I'm using similar functionality to transplant player character from "room" to "room". Each "room" is dynamically loaded / discarded, and has own transform.
The text was updated successfully, but these errors were encountered: