-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Take item and skeleton transforms into account when calculating mesh AABB in 2D #76184
Conversation
5448e18
to
5656acf
Compare
Works if you move the element, but does not work if you move the element's parent, i.e. change the element's global transform. Here, you can use my MRP: Just pick |
If it is anything like in 3.x, the skeleton base transform is in global space, and I have a feeling the transform you are passing to the function for the mesh may be in local space, whereas afaik you may need it in global space to calculate the relative xform. This could be why it works with no global space offset, but breaks as soon as the polygon is moved around outside of local space. In 3.x at least, all the canvas item xforms are in local space. They are only concatenated to "final space" during the render. Final space is a combination of global space and the camera transform (I'm not at all sure this makes things simpler, versus just calculating final space from global space in the shader, but that's how it currently works). This meant getting the I haven't examined master in detail to know whether this system is the same or not. |
5656acf
to
dcf199b
Compare
Just to confirm this is still broken with the latest commit, if you load the example project "polygon2dcullbug" and move |
That's right. More work will need to be done to properly expose the "final" transform of the Node. Right now we only have access to the Node's transform, not its parent. The trouble is the "final" transform bakes in the viewport transform, which we don't want. For updating the skeleton, we have to extract the "final" transform just before updating. We will have to do something similar here as well |
@lyuma Do you think you can review this for fixing the broken lod issue? |
Clayjohn said that the 3d case should be extracted into its own PR as we didn't fix the issue with Skeleton2D so we haven't merged this yet. |
Started a little of trying to port #75612 this morning to master. However I didn't realise just how much master has diverged from 3.x. Skinned It's also some time since I did the original PR so it's not super fresh in memory if there might be an alternate way of doing this in master. |
Superseded by #84451 |
Fixes: #74656
There were two issues here:
This PR also forward ports the debug rect code from #75612 to properly validate that the changes were made correctly.
I tested using the MRP from #74656 (comment). But I modified it to use the debugging rects from the MRP in #75612
polygon2dcullbug-with-debug.zip
Before merging I would like to test this further in other cases. Perhaps @SlugFiller can confirm this fixes their original issue as well
Before this PR:
After this PR