Skip to content
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

[4.0 stable] Node3D global_position and global_rotation variables not set before calling add_child #74631

Closed
grumpOldman opened this issue Mar 9, 2023 · 2 comments
Labels

Comments

@grumpOldman
Copy link

Godot version

4.0 stable

System information

Windows 10

Issue description

When setting global_position or global_rotation variables after creating a Node3D in code then using add_child to append it to the current node. Only the last one is set and the others are ignored.

Steps to reproduce

Create Node3D variable in code
var node3d = Node3D.new()

Set Positions before add_child

node3d.global_position.x = 64 
node3d.global_position.z = 64

then add_child to Node
add_child(node3d)

Only the global position Z is set.

Minimal reproduction project

bug.zip

@dalexeev
Copy link
Member

dalexeev commented Mar 9, 2023

To me this looks to be expected. Until you add a node to the tree, it cannot have a global position, rotation, etc., since we don't yet know which branch the node will be added to. Perhaps we need to clarify this point in the docs and/or add a warning.

@akien-mga
Copy link
Member

Duplicate of #30445

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants