Skip to content

4 new shapes - #422

Closed
ds5678 wants to merge 14 commits into
bepu:masterfrom
ds5678:additional-shapes
Closed

ds5678 wants to merge 14 commits into
bepu:masterfrom
ds5678:additional-shapes

Conversation

@ds5678

@ds5678 ds5678 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Pull Request Description

This pull request will add support for 4 new primitive shapes to the zoo.

  • Cone
  • Pyramid (rectangular base)
  • Wedge (right prism of right triangle)
  • Rectangle

Justification

Cone

Although convex hulls can inefficiently approximate a cone (similar to cylinders), accurate modeling of the smoothness can only come from first-class support. Also, this is the only shape that can accurately model shotgun spray.

Pyramid

This is a common shape used in architecture, and it's the only shape capable of representing a player's field of view accurately.

Wedge

Wedges can model stairs, ramps, and roofs. These objects are ubiquitous in games.

Rectangle

These one-sided shapes are better than boxes for modeling floors, walls, and ceilings. They're infinitely thin and always push in the correct direction.

Current Status

In line with the contributing guidelines, I wanted to give you a heads up about me working on this, so this pull request is still a draft.

Done

  • I implemented the data types for the 4 new shapes. This includes all related interface methods, such as raycasting.
  • I created a unit test project with tests for lots of the existing code.
  • I have stub implementations for all of the new pairwise testers.

To Do

  • I'm currently working on implementing the new pairwise testers.
  • The unit tests aren't currently meeting my standard for code quality and need cleaned up.

Review Process

When I'm done, I expect the number of lines changed to be around 20 thousand. I want to make this as easy as possible for you to review.

  • I can split this into multiple pull requests. For example, Rectangle is more-or-less done right now.
  • I can revert commits like ds5678@779731f if you don't like them.
  • If these shapes would be a major maintenance burden on you, I can close this pull request and keep the changes downstream.

Updated collision tester overloads to throw NotSupportedException where variants are intentionally unsupported. Redirected sphere-based tester entry points to the appropriate narrower overloads instead of throwing, and removed an unused System import from SpherePairTester.cs.
Update `CommonSettings.props` to target `net10.0` instead of `net8.0`.
Add `VectorExtensions` for `System.Numerics` vectors:
- `!` for `Vector<int>` bitwise-not
- `<`, `>`, `<=`, `>=` for `Vector<float>` masks
- `NegativeOne` for `Vector<float>`
- generic `Min`, `Max`, and `ClampZeroOne` helpers
Add a new BepuPhysicsTests xUnit project with collision and raycast test infrastructure, shape-pair collision coverage, and direct-vs-wide ray test coverage for primitive shapes; update the solution to include the new test project.
Reordered default sweep task registrations in DefaultTypes.cs and grouped Cylinder sweep registrations more logically without changing coverage.
Add new convex collidable shapes for cone, pyramid, rectangle, and wedge with shape-specific ray casting, wide/SIMD support, inertia/bounding data, and ray-cast tests.
Register Cone, Pyramid, Wedge, and Rectangle for pair testing and GJK sweeps; add tester structs for the new combinations; and route sphere interactions through shared GJK/contact overloads.

Tester structs currently throw NotImplementedException
Convert them to convex hulls and use testers for convex hulls
Added XML documentation comments to `IBoundsQueryableCompound` methods in `ConvexCompoundOverlapFinder.cs`, clarifying the `FindLocalOverlaps` overloads, their generic parameters, and the meaning of each argument for local-space overlap queries and sweep tests.
…Wide>

This enables us to eliminate the need for 10 pairwise collision testers
@ds5678 ds5678 mentioned this pull request Oct 5, 2026
@ds5678

ds5678 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Rejected on Discord

@ds5678 ds5678 closed this Oct 5, 2026
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