Fix bullet penetration rendering multiple tracers#1895
Merged
Conversation
The bullet penetration logic is recursive, and this could cause bullets to render multiple tracers per one shot. Check that the current penetrating force of the shot equals the used weapon's original penetrating force, i.e. that no surfaces have yet been penetrated. This asserts that any penetrated surfaces will incur a non-zero penetration cost.
DESTROYGIRL
approved these changes
Mar 29, 2026
sunzenshen
approved these changes
Mar 30, 2026
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.
Description
Fix a situation where a bullet that penetrates a surface would render a new tracer for each penetration (from the muzzle, not from the point beyond the penetration!)
The bullet penetration logic is recursive, so each call to
FireBulletswould set up a new tracer. This PR will prevent the tracer creation if the associatedFireBulletsInfo_t::m_flPenetrationvalue does not match the weapon'sGetPenetrationvalue, i.e. if the attack has already penetrated and hence lost some of its penetration value. As such, this fix also asserts that all surface materials will have a non-zero penetration resistance value associated with them (which is the case currently).An alternative to outright blocking the reentrant tracers would be firing the continuation tracer from the bullet hole of the penetration exit (instead of doing multi-tracers from the gun, which simply looks weird), but since the issue for this bug mentions particle budget worries, it would probably have to be implemented as a single tracer that gets fired at the termination of the penetration chain. In any case, I considered that out of scope for this fix.
Toolchain
Linked Issues