Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add geometric primitives to bevy_math::prelude #11432

Merged
merged 3 commits into from
Jan 20, 2024

Conversation

Jondolf
Copy link
Contributor

@Jondolf Jondolf commented Jan 20, 2024

Objective

Currently, the primitives module is inside of the prelude for bevy_math, but the actual primitives are not. This requires either importing the shapes everywhere that uses them, or adding the primitives:: prefix:

let rectangle = meshes.add(primitives::Rectangle::new(5.0, 2.5));

(Note: meshing isn't actually implemented yet, but it's in #11431)

The primitives are meant to be used for a variety of tasks across several crates, like for meshing, bounding volumes, gizmos, colliders, and so on, so I think having them in the prelude is justified. It would make several common tasks a lot more ergonomic.

let rectangle = meshes.add(Rectangle::new(5.0, 2.5));

Solution

Add primitives::* to bevy_math::prelude.

@Jondolf Jondolf added C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Math Fundamental domain-agnostic mathematical operations labels Jan 20, 2024
crates/bevy_math/src/lib.rs Outdated Show resolved Hide resolved
@alice-i-cecile alice-i-cecile added this to the 0.13 milestone Jan 20, 2024
Jondolf and others added 2 commits January 20, 2024 17:39
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jan 20, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jan 20, 2024
Merged via the queue into bevyengine:main with commit c6f4583 Jan 20, 2024
23 checks passed
@Jondolf Jondolf deleted the primitives-in-prelude branch January 20, 2024 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Math Fundamental domain-agnostic mathematical operations C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants