Quick answer: On each penetrated surface, look up a per-material penetration cost, multiply remaining damage by a falloff based on that cost and the slab thickness, and stop when the bullet's penetration power is spent.
A pistol round shreds through concrete for full damage because penetration ignores what it passes through. Wood and steel should differ. Per-material attenuation by thickness fixes the model. Here is how.
How to fix it
1. Tag surfaces with a material
Assign each collider a physical material (wood, drywall, concrete, steel) carrying a penetration cost and a damage-loss factor. Read it from the trace's hit surface, not a global constant.
2. Measure exit thickness
After an entry hit, trace from inside the object to find the exit point and compute the slab thickness. Multiply the cost by thickness so a thin door barely attenuates while a thick wall stops the round.
3. Spend a penetration budget
Give the bullet a penetration power value; subtract each surface's cost and reduce remaining damage proportionally. When the budget hits zero, stop the trace so rounds cannot tunnel through unlimited walls.
Catching the ones you can't reproduce
The hardest version of this to fix is the one you can't reproduce — it only happens on a player's hardware, OS, driver, or save state, under conditions that simply aren't present on your machine. A report that says “it crashed” or “it froze” gives you nothing to act on, so the bug survives release after release while quietly costing you players.
Automatic error capture closes that gap. Each failure arrives with its full stack trace, the device and OS, the build number, and a breadcrumb trail of what the player did right before it broke, so even a failure you have never seen becomes a specific, reproducible issue. Fold identical failures into one signature ranked by how many players each hits, and your worklist sorts itself worst-first instead of arriving as a stream of vague complaints.
This is where a tool like Bugnet earns its place. Its SDK captures every error automatically with the full stack trace plus device, OS, memory, build, and game-state context, folds duplicates into one grouped issue with an occurrence count, and ties each to the build it first appeared on — so you fix the problem that hurts the most players first and confirm it is gone when its signature disappears from the next release.
The bug you can't reproduce isn't gone — it's just invisible until you capture it from the player's device.