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

Make Anchor work for Rectangle Mesh2d #17088

Open
colepoirier opened this issue Jan 2, 2025 · 1 comment
Open

Make Anchor work for Rectangle Mesh2d #17088

colepoirier opened this issue Jan 2, 2025 · 1 comment
Labels
A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!

Comments

@colepoirier
Copy link
Contributor

colepoirier commented Jan 2, 2025

What problem does this solve or what need does it fill?

Currently inserting Anchor when using a Rectangle mesh2d component has no effect (anchor will be the default - center). Given that Anchors work for sprites which IIUC are just rectangle meshes with images on them I don't see why this shouldn't also work for Rectangle mesh2d's.

What solution would you like?

Take into account the Anchor component in Mesh2d rendering for the Rectangle primitive shape and apply (the same transform logic that exists in the sprite pipeline for anchors)[https://github.com/bevyengine/bevy/blob/3f2baf8ecd7f8948fb67cf11b0f2811d7a1ca1ae/crates/bevy_sprite/src/render/mod.rs#L734].

What alternative(s) have you considered?

None.

Additional context

I'd be happy to implement this and submit a PR for it but I'd need some guidance on the implementation.

@colepoirier colepoirier added A-Rendering Drawing game state to the screen A-Transform Translations, rotations and scales C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Jan 2, 2025
@BenjaminBrienen BenjaminBrienen added S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! and removed S-Needs-Triage This issue needs to be labelled A-Transform Translations, rotations and scales labels Jan 2, 2025
@colepoirier
Copy link
Contributor Author

Comment about this on discord form @tychedelia "mesh primitives like Rectangle are all really just a description of how to build a mesh asset. Rectangle doesn't exist as a component / at the type level. so really you wouldn't be writing an anchoring system over rectangles but over 2d meshes in general." ... "if you just want it to work with rects that wouldn't be hard to implement, but is a reason why it would require more thought when the apis are eventually brought together."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!
Projects
None yet
Development

No branches or pull requests

2 participants