From e2f14f459dfb2ab62c439925beb120f4d1b16af2 Mon Sep 17 00:00:00 2001 From: Grateful Forest <168700820+gratefulforest@users.noreply.github.com> Date: Tue, 9 Dec 2025 09:18:35 +1030 Subject: [PATCH] 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. --- goalc/build_level/collide/jak1/collide_bvh.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/goalc/build_level/collide/jak1/collide_bvh.cpp b/goalc/build_level/collide/jak1/collide_bvh.cpp index a726767635..eb3a688220 100644 --- a/goalc/build_level/collide/jak1/collide_bvh.cpp +++ b/goalc/build_level/collide/jak1/collide_bvh.cpp @@ -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)); }