mirror of
https://github.com/open-goal/jak-project
synced 2026-07-08 14:36:52 -04:00
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:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user