Repository navigation
P3: Check collision LOD pieces that have no detail0 partner - #8072
Open
dustinspace217 wants to merge 2 commits into
Open
dustinspace217 wants to merge 2 commits into
dustinspace217 wants to merge 2 commits into
Conversation
With $Collision LOD set, collision walked the detail0 tree and swapped each piece for its lower-detail partner, so pieces that exist only in the lower detail model were never checked and shots passed through them. Also walk the collision LOD's children that have no detail0 partner.
LOD partners are paired by name, so two pieces in the detail0 tree can pair with each other; walking a partner's children from every swapped piece could then revisit the same tree. Only the detail0 root walks its collision LOD's unpartnered children, and inside that tree lower-detail partners are skipped because their detail0 piece already checks them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
With
$Collision LODset, pieces that exist only in the lower-detail model now take hits. Only ships that check collisions or spread shields from a lower LOD are affected.Fixes #4112
Why?
On the Blue Planet GTD Erebus,
$Collision LOD: 1lets shots pass straight through the back half of the ship. Its detail1 hull piece,hull_back1, has no detail0 partner, and collision only reaches lower-detail pieces through a detail0 partner, so it was never checked.How?
When the detail0 root is swapped for its collision LOD,
mc_check_subobjnow also walks that LOD's children. Inside that tree it skips pieces that are LOD partners of something in detail0, since their detail0 piece already checks them. Only the root does this, because partners are matched by name and two detail0 pieces can pair with each other.Goober asked on the issue whether the game could detect this at load. Since these pieces now get checked, I didn't add a load warning.
Testing?
Master 94d278a vs. this branch, Release, OpenGL and Vulkan, MediaVPs 5.0.3, mission sm1-01. The test mod held only the Blue Planet Erebus model, its hull textures, and two ship classes identical except for
$Collision LOD: 1. A Lua script fired 90 shots across each Erebus's side and 153 at a retail GTD Orion.The LOD 1 Erebus is now hit along the same lines as the normal one. The other two matched master shot for shot on both renderers. One shot at each turret of an Orion set to
$Collision LOD: 1(its main turrets have LOD partners) gave the same submodels and subsystem damage on master and the branch. A Debug build's log through the shots and the mission to 2:30 showed no new warnings against master's.Not tested: ship-ship collisions, debris, props,
+Spread From LODshields,$Collision LOD: 2, destroyed subsystems.Anything Else?
A swapped piece's polygons are still only tested when the shot crosses the detail0 piece's bounding box, as the wiki describes, so LOD geometry sticking out past it can still be missed. Using the partner's own box is a one-line change if you'd like it.
I used Claude Code to help write and test this.