bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.39k stars 3.59k forks source link

Only use the AABB center for mesh visibility range testing if specified. #16468

Closed pcwalton closed 2 days ago

pcwalton commented 3 days ago

PR #15164 made Bevy consider the center of the mesh to be the center of the axis-aligned bounding box (AABB). Unfortunately, this breaks crossfading in many cases. LODs may have different AABBs and so the center of the AABB may differ for different LODs of the same mesh. The crossfading, however, relies on all LODs having precisely the same position.

To address this problem, this PR adds a new field, use_aabb, to VisibilityRange, which makes the AABB center point behavior opt-in.

@BenjaminBrienen first noticed this issue when reviewing PR #16286. That PR contains a video showing the effects of this regression on the visibility_range example. This commit fixes that example.

Migration Guide

alice-i-cecile commented 2 days ago

Great docs!