diff options
| author | Juan Linietsky <reduzio@gmail.com> | 2020-12-24 08:45:19 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-24 08:45:19 -0300 |
| commit | 4d9b95f3a88ab5a225514d503cbf06926840ab02 (patch) | |
| tree | 67efb0c9b820a3653e06d58022432a2cf2de1339 /core | |
| parent | dbd00d932e27088f6f8a8fc88e5dd75796719ada (diff) | |
| parent | 6d687de9b84f85c87846e6a48b81b1c495bb926b (diff) | |
| download | redot-engine-4d9b95f3a88ab5a225514d503cbf06926840ab02.tar.gz | |
Merge pull request #44651 from lawnjelly/bvh_world_aabb
Fix BVH to world_aabb, and call update
Diffstat (limited to 'core')
| -rw-r--r-- | core/math/dynamic_bvh.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/math/dynamic_bvh.cpp b/core/math/dynamic_bvh.cpp index 5f87f75b61..a53f8d1eb8 100644 --- a/core/math/dynamic_bvh.cpp +++ b/core/math/dynamic_bvh.cpp @@ -354,10 +354,17 @@ void DynamicBVH::_update(Node *leaf, int lookahead) { void DynamicBVH::update(const ID &p_id, const AABB &p_box) { ERR_FAIL_COND(!p_id.is_valid()); Node *leaf = p_id.node; - Node *base = _remove_leaf(leaf); + Volume volume; volume.min = p_box.position; volume.max = p_box.position + p_box.size; + + if ((leaf->volume.min == volume.min) && (leaf->volume.max == volume.max)) { + // noop + return; + } + + Node *base = _remove_leaf(leaf); if (base) { if (lkhd >= 0) { for (int i = 0; (i < lkhd) && base->parent; ++i) { |
