-
Notifications
You must be signed in to change notification settings - Fork 16
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
Sprites & BItmapTexts that are rotated are made invisible too soon and visible not early enough #2
Comments
Indeed, code for calculating AABB is handling scaling, but missing rotation at: @davidfig Would adding code for handling rotation of all objects be feasible for performance? Such as https://www.asawicki.info/news_1376_calculating_aabb_of_a_rotated_2d_rectangle |
Yes, performance would be fine; it's what pixi already does (although they use matrices). An alternative is to use pixi's getBoundingBox(), which already includes rotations and skewing. My original version of pixi-cull used that function, but after I struggled unsuccessfully to get it working, I ended up switching to my own simple bounding box calculation. I didn't need rotations, which is why I omitted it. Happy to accept a PR if you want to add rotations to the calculations. I don't think it takes into account anchors either, so if it's important to you, feel free to add it. |
I got a working code with rotation, but it's missing other transformations.
Did you mean getBounds method? It would be ideal to use a native PIXI method, but there are lots of complains about this method. When I tried it, sometimes it returned exactly 1/2 of the expected values, or it was completely off, no idea why. Maybe we could somehow apply world+localTransform to the 4 corner points? |
http://nikkikoole.github.io/culltest/
https://github.com/NikkiKoole/nikkikoole.github.io/blob/master/culltest/main.js
Per sprite and bitmap text i also draw a rectangle for its bounds.
Those are culled correctly, but the sprites themselves arent.
I also tried it with the latest release from a day ago, also i am on pixi 5rc2 but see the same behaviour on 4.8.
Or am i just overlooking something obvious alltogether?
ps. when all the sprites and bitmaptexts arent rotated its working correctly.
edit:
just using the demo from you readme file:
add
where the red boxes are generated
and you see the behaviour too:
dragging around you see some boxes being deleted from the view too soon.
The text was updated successfully, but these errors were encountered: