-
-
Notifications
You must be signed in to change notification settings - Fork 19.6k
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
get_aabb() returns AABBs with incorrect position-values #42095
Comments
@okapii Did you find a solution to this issue? |
@Calinou : I thought I did. But by now I am even more stumped. :) Right now I am just unsure if this is a bug or an issue on my end which is why I did not reopen things. I have come to realise that the AABBs never reflect position, rotation and scale of instances. get_aabb() always leads to the bounding box of the unrotated, unscaled object positioned at the origin resulting in false collision detection. Position can be accounted for by altering the AABBs position-property according to the instance's origin but I am fairly stumped now as to how to account for rotation and scale. Sadly I can't find too much information on the whole AABB topic in Godot in general. |
As I still can't seem to find a solution here is an illustration of the issue. It is still the basic code form above.
As one can see what matters is not the actual position / rotation / scale (as seen on the left side of the images) but the default rotation where in the 2nd one this leads to a small intersection while in reality both versions should report "true" as the bounding boxes should intersect. |
Could you check if |
Yeh, that was the obvious solution I was afraid of potentially just not seeing. So yeah, thanks, that worked! I guess the method is not documented in https://docs.godotengine.org/de/stable/classes/class_aabb.html for being inherited from VisualInstance? |
This also clarifies that `get_aabb()` returns the AABB in local space. See godotengine#42095.
This also clarifies that `get_aabb()` returns the AABB in local space. See godotengine#42095.
This also clarifies that `get_aabb()` returns the AABB in local space. See godotengine#42095. (cherry picked from commit 9712f8f)
Godot version:
Godot v3.2.3.rc6.official
OS/device including version:
MacBook Pro (13", 2020)
2,3 GHz Quad-Core Intel Core i7
16 GB 3733 MHz LPDDR4X
Intel Iris Plus Graphics 1536 MB
Issue description:
I hope that this is not a conceptual misunderstanding on my end but it seems to me that the position property of AABBs is reporting incorrect values.
Running this code on the scene shown above yields the following output:
As one can see all position values are identical despite the cubes being positioned differently.
Originally I assumed that this was by design and that one would have to offset the AABBs utilising the object's origin-coordinate to get the correct position of the AABB in the global world. But that surely can't be right as this would result in varying / wrong values depending on where the origin is positioned in relation to the actual geometry.
Steps to reproduce:
See above
Minimal reproduction project:
200915_Godot_AABB.zip
The text was updated successfully, but these errors were encountered: