forked from bevyengine/bevy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement meshing for
Capsule2d
(bevyengine#11639)
# Objective The `Capsule2d` primitive was added in bevyengine#11585. It should support meshing like the other 2D primitives. ## Solution Implement meshing for `Capsule2d`. It doesn't currently support "rings" like Bevy's `Capsule` shape (not `Capsule3d`), but it does support resolution to control the number of vertices used for one hemicircle. The total vertex count is two times the resolution; if we allowed setting the full vertex count, odd numbers would lead to uneven vertex counts for the top and bottom hemicircles and produce potentially unwanted results. The capsule looks like this (with UV visualization and wireframe) using resolutions of 16, 8, and 3: ![Resolution 16](https://github.com/bevyengine/bevy/assets/57632562/feae22de-bdc5-438a-861f-848284b67a52) ![Resolution 8](https://github.com/bevyengine/bevy/assets/57632562/e95aab8e-793f-45ac-8a74-8be39f7626dd) ![Resolution of 3](https://github.com/bevyengine/bevy/assets/57632562/bcf01d23-1d8b-4cdb-966a-c9022a07c287) The `2d_shapes` example now includes the capsule, so we also get one more color of the rainbow 🌈 ![New 2D shapes example](https://github.com/bevyengine/bevy/assets/57632562/1c45b5f5-d26a-4e8c-8e8a-e106ab14d46e)
- Loading branch information
Showing
3 changed files
with
167 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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