Implement #7718 (Exposing hitboxes and their bounds)#32
Implement #7718 (Exposing hitboxes and their bounds)#32yuberee wants to merge 0 commit intoFacepunch:masterfrom
Conversation
Having model hitboxes be this accessible allows us to easily target and modify specific ones such as increasing the size of the head hitbox on lower game difficulties or removing hitboxes entirely on "dismembered" enemies. |
|
This seems mostly fine to me. I don't like the fact you can add and remove hitboxes but AddHitbox is already public here but that may have been a mistake. |
There was a problem hiding this comment.
Pull request overview
This PR implements issue #7718 by exposing hitboxes and their bounds to the public API. It adds methods to retrieve and manipulate hitboxes in ModelHitboxes, exposes the Bounds property on Hitbox, and makes the ModelChanged event public on ModelRenderer.
Changes:
- Added methods to query hitboxes by bone index, bone, bone name, and physics body
- Exposed the
Boundsproperty onHitboxfrom internal to public - Made
ModelChangedevent onModelRendererpublic with documentation - Added
HitboxesRebuiltevent to notify when hitboxes are rebuilt
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| engine/Sandbox.Engine/Scene/Components/Render/ModelRenderer.cs | Made ModelChanged event public and added XML documentation |
| engine/Sandbox.Engine/Scene/Components/Game/ModelHitboxes.cs | Added GetHitboxes, RemoveHitbox, and overloaded GetHitbox methods; added HitboxesRebuilt event; refactored properties to use field keyword |
| engine/Sandbox.Engine/Scene/Components/Game/Hitbox.cs | Changed Bounds property visibility from internal to public |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Added GetHitboxes and RemoveHitbox to ModelHitboxes
Expose Hitbox's bounds
Thank you