Fix getElementBoundingBox/radius for engineRequestModel custom models (#4925)#5003
Open
QueryOfficial wants to merge 1 commit into
Open
Fix getElementBoundingBox/radius for engineRequestModel custom models (#4925)#5003QueryOfficial wants to merge 1 commit into
QueryOfficial wants to merge 1 commit into
Conversation
- Introduced functions to create and destroy owned collision model copies, ensuring collision geometry is not shared. - Implemented bounds accumulation from RenderWare objects to update collision model bounds accurately. - Enhanced model creation methods to clone parent collision models, ensuring proper collision data handling. - Added necessary member variables and updated existing methods to integrate new functionality. This change improves collision handling and model integrity during runtime, addressing potential issues with shared collision data.
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.
Summary
Fix
getElementRadiusandgetElementBoundingBoxfor custom models created withengineRequestModel.Custom model slots no longer share the parent model’s
pColModelbounds data. After a successful DFF replace, bounds are recalculated from RenderWare atomic geometry. Visual bounds recalculation is skipped when a custom COL is applied viaengineReplaceCOL.Changes are in:
Client/game_sa/CModelInfoSA.hClient/game_sa/CModelInfoSA.cppMotivation
Fixes #4925.
Custom models created with
engineRequestModelalways returned the parent model’s radius and bounding box. For object models with the default parent 1337 (trash can), scripts consistently saw the same radius and bounding box values regardless of the replaced DFF.Root cause:
Make*Modelshallow-copied the parentCBaseModelInfoSAInterface, so the custom slot shared the parent’spColModelengineReplaceModelonly replaced visual geometry and did not update boundsgetElementRadius/getElementBoundingBoxread stale/shared collision bounds viaCModelInfo::GetBoundingBox()Test plan
engineRequestModel("object"), replace the DFF, create an object, and verifygetElementRadius/getElementBoundingBoxdiffer from parent 1337 values.engineRequestModel("object", 1225)) and confirm returned bounds match the custom DFF, not the parent.engineReplaceCOL, verify bounds come from the COL, and confirm a later DFF replace does not overwrite them.engineFreeModeldoes not crash or leak.MakeCustomModel.Checklist