Skip to content

feat: add ShapeTypeStaticChainLoop and ShapeTypeEdge collider shapes#883

Open
AnthonyWadham wants to merge 1 commit intoAnthony/fix-component-updates-post-stepfrom
Anthony/add-missing-shapes
Open

feat: add ShapeTypeStaticChainLoop and ShapeTypeEdge collider shapes#883
AnthonyWadham wants to merge 1 commit intoAnthony/fix-component-updates-post-stepfrom
Anthony/add-missing-shapes

Conversation

@AnthonyWadham
Copy link
Copy Markdown
Contributor

@AnthonyWadham AnthonyWadham commented Apr 2, 2026

TL;DR

Added two new collider shape types: ShapeTypeStaticChainLoop for closed chain boundaries and ShapeTypeEdge for single line segments.

What changed?

  • Added ShapeTypeStaticChainLoop constant that creates closed chain loops where the last vertex automatically connects to the first
  • Added ShapeTypeEdge constant for single line segments using exactly 2 points, providing a lighter alternative to 2-point chains
  • Added EdgeVertices [2]Vec2 field to ColliderShape struct for edge geometry data
  • Updated validation logic to include the new shape types and validate EdgeVertices
  • Implemented buildChainLoopShape() and buildEdgeShape() functions to create the corresponding Box2D shapes
  • Enhanced body type validation to prevent dynamic bodies from using chain loop or edge shapes (they require zero mass)
  • Updated deep copy and equality comparison functions to handle the new EdgeVertices field
  • Exported the new shape type constants in the public plugin interface

Why make this change?

This extends the physics2D plugin's shape capabilities to support more diverse collision geometry. Chain loops provide an efficient way to create sealed boundaries without manually connecting the last point to the first, while edge shapes offer a performance-optimized option for simple line segments compared to using chains with only two points.

Copy link
Copy Markdown
Contributor Author

AnthonyWadham commented Apr 2, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label graphite/merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@AnthonyWadham AnthonyWadham changed the title feat: add missing shapes of chainloop and edge feat: add ShapeTypeStaticChainLoop and ShapeTypeEdge collider shapes Apr 2, 2026
@AnthonyWadham AnthonyWadham requested a review from rmrt1n April 2, 2026 19:49
@AnthonyWadham AnthonyWadham marked this pull request as ready for review April 2, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant