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

Fix GeometryInstance3D Custom AABB assignment in the editor not working #90440

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Apr 9, 2024

This also fixes error spam when changing Custom AABB on a MeshInstance3D that has no Mesh resource assigned yet (which is allowed in the editor). This avoids pitfalls when assigning a custom AABB in a script when loading meshes at runtime.

I've tested this in all rendering methods and it works as expected.

Testing project: test_custom_aabb.zip

Before

An AABB that is too small for the mesh is intentionally used to cull objects earlier than intended, so it makes a difference on screen. Here, the custom AABB is ignored when the scene is loaded due to the bug:

simplescreenrecorder-2024-04-09_19.00.48.mp4

After (this PR)

An AABB that is too small for the mesh is intentionally used to cull objects earlier than intended, so it makes a difference on screen. Here, the custom AABB is being obeyed as expected:

simplescreenrecorder-2024-04-09_19.01.05.mp4

This also fixes error spam when changing Custom AABB on a MeshInstance3D
that has no Mesh resource assigned yet (which is allowed in the editor).
This avoids pitfalls when assigning a custom AABB in a script when
loading meshes at runtime.
@Calinou Calinou added this to the 4.3 milestone Apr 9, 2024
@Calinou Calinou marked this pull request as ready for review April 9, 2024 17:02
@Calinou Calinou requested a review from a team as a code owner April 9, 2024 17:02
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the issue here is that the custom_aabb is being loaded before the base (mesh etc.) is set on the object.

It seems this code has been present since instance_set_custom_aabb() was added #12645. Which means this bug has probably been around since custom_aabb was exposed #70114

@clayjohn clayjohn added the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Apr 9, 2024
@akien-mga akien-mga merged commit 258f270 into godotengine:master Apr 10, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@Calinou Calinou deleted the geometryinstance3d-fix-custom-aabb-assignment branch April 10, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release topic:rendering topic:3d
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when loading scene with custom AABB on a GeometryInstance3D
3 participants