-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Global position losing axis value when assigning axis values separately #87896
Comments
I don't see this as a bug, so much as a misunderstanding new Godot users seem to run into. I'll quote You should only alter the add_child(boxInst)
boxInst.global_position.x = x-(width>>1)
boxInst.global_position.z = z-(depth>>1) As a side note, like the linked issue says, only the last set will work which is why your "workaround" coincidentally works in this case. To demonstrate, the following code will leave all boxes at 0,0: boxInst.global_position.x = x-(width>>1)
boxInst.global_position.z = z-(depth>>1)
boxInst.global_position.z = 0
add_child(boxInst) I don't know if this is mentioned in the docs or tutorials, but if it's not it probably should as I see this come up often. First Finally I will add something that I think is sort of a bug. If you try to use |
This pops up many, many times in different forms. It would be nice to address them once and for all. It seems these kinds of issues stem from #30445 and may be solved by #70443.
I have made note of it myself in #87440 |
While I agree both |
Seeing as this apparently isn't a bug but rather a misunderstanding of the use of Nodes I'm closing this issue |
Let's keep this open until the PR has merged to track the documentation issue 🙂 |
In addition to being documented in the Node3D (and Node2D?) class reference, this seems like a good candidate to be documented somewhere in the manual as well, wherever global space/global coordinates are explained. I'm not sure which page is best for that, since currently the there are several "entry points" into the docs - you can optionally read some or all of the Getting Started section, and the Manual section also has a couple "entry points" for understanding 3D coordinate spaces. |
Tested versions
-Reproducible in Godot 4.2.1
System information
Godot v4.2.1.stable - Fedora Linux 39 (Workstation Edition) - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4060 Ti (nvidia; 535.154.05) - AMD Ryzen 7 5800X3D 8-Core Processor (16 Threads)
Issue description
I tried to generate a grid of boxes. Assigning the z position immediately after assigning x caused the x value to default to 0, same is true for the inverted setup or assigning z -> y -> x. All values except x are 0.
Steps to reproduce
Minimal reproduction project (MRP)
MRP.zip
A workaround is to do something in between assigning the values. Example:
The text was updated successfully, but these errors were encountered: