jak1, jak2, jak3: fix missing collision in custom levels (#4060)

After verifying so many things about the BVH trees being correct, I
noticed a pattern across missing collision: all missing collision was
always a face-containing child that was inside a node alongside another
non-face-containing parent.

This minimalist fix simply adds a wrapper so that when a face-containing
child exists alongside a non-face-containing parent, ie. `if (has_leaves
&& has_not_leaves)`, then it simply wraps the face-containing node in
another parent, so that face-containing spheres and non-face-containing
parents don't co-exist in the same node.

The result: restored collision for missing sections in custom levels.
This commit is contained in:
Grateful Forest
2025-12-09 09:18:35 +10:30
committed by GitHub
parent 5f1676d921
commit e2f14f459d
@@ -219,9 +219,10 @@ void split_recursive(CNode& to_split) {
for (auto& c : temp_children) {
if (!c.faces.empty()) {
to_split.child_nodes.emplace_back();
to_split.child_nodes.emplace_back();
split_node_once(c, &to_split.child_nodes[to_split.child_nodes.size() - 1],
&to_split.child_nodes[to_split.child_nodes.size() - 2]);
auto& wrapper = to_split.child_nodes.back();
wrapper.child_nodes.clear();
wrapper.child_nodes.push_back(std::move(c));
compute_my_bsphere_ritters(wrapper);
} else {
to_split.child_nodes.push_back(std::move(c));
}