Skip to content

Implement #7718 (Exposing hitboxes and their bounds)#32

Closed
yuberee wants to merge 0 commit intoFacepunch:masterfrom
yuberee:master
Closed

Implement #7718 (Exposing hitboxes and their bounds)#32
yuberee wants to merge 0 commit intoFacepunch:masterfrom
yuberee:master

Conversation

@yuberee
Copy link
Copy Markdown
Contributor

@yuberee yuberee commented Nov 26, 2025

Added GetHitboxes and RemoveHitbox to ModelHitboxes
Expose Hitbox's bounds
Thank you

Comment thread engine/Sandbox.Engine/Scene/Components/Game/ModelHitboxes.cs Outdated
@yuberee
Copy link
Copy Markdown
Contributor Author

yuberee commented Nov 27, 2025

  • Added summaries
  • Added GetHitbox with overloads for:
    • Bone index
    • Bone name
    • BoneCollection.Bone
    • PhysicsBody
  • Added HitboxesRebuilt action to subscribe to

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.
My other very specific use case was allowing bots to target hitboxes such as the chest and pelvis if they had shotguns.

@aylaylay
Copy link
Copy Markdown
Contributor

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.

@handsomematt handsomematt added the triaged triaged pull-requests are replicated on the internal sbox repo label Jan 15, 2026
Copilot AI review requested due to automatic review settings January 16, 2026 09:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Bounds property on Hitbox from internal to public
  • Made ModelChanged event on ModelRenderer public with documentation
  • Added HitboxesRebuilt event 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.

Comment thread engine/Sandbox.Engine/Scene/Components/Game/ModelHitboxes.cs
Comment thread engine/Sandbox.Engine/Scene/Components/Game/ModelHitboxes.cs Outdated
Comment thread engine/Sandbox.Engine/Scene/Components/Game/ModelHitboxes.cs Outdated
Comment thread engine/Sandbox.Engine/Scene/Components/Game/ModelHitboxes.cs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triaged triaged pull-requests are replicated on the internal sbox repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants