Update Aabb
on Sprite::custom_size
changed.
#10587
Labels
A-Rendering
Drawing game state to the screen
C-Bug
An unexpected or incorrect behavior
D-Trivial
Nice and easy! A great choice to get started with Bevy
Motivation
This PR is a subset of #4294 : the
Aabb
component is never automatically updated after it is added to an entity, even when it should be (for example the Mesh vertices positions are updated).To fix #4294 integrally, #5069 needs to be solved, as we need to rely on asset change detection for most of the cases.
From Bevy 0.11.0, frustum culling was added for 2D entities, and an
Aabb
component is automatically added to entities with aSprite
andHandle<Image>
component (bycalculate_bounds_2d
), and never updated. To update it automatically, in the case whereSprite::custom_size
isNone
, we would require the image asset change detection. However, whenSprite
is changed andcustom_size
is set toSome
, we could update theAabb
in the current state of Bevy.Note
Simply detecting
Sprite
change could trigger false positives, like when another field thancustom_size
oranchor
is changed, theAabb
would still be needlessly recalculated in this case. I don't think it is a big problem as Aabb calculation is trivial in that case. If it is,custom_size
could be isolated in a separate component.The text was updated successfully, but these errors were encountered: