Skip to content

Extendable gizmos primitives 3d #20049

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

lynn-lumen
Copy link
Contributor

@lynn-lumen lynn-lumen commented Jul 9, 2025

Objective

Solution

  • GizmoPrimitive3d is now implemented for the primitive itself, allowing external primitives to also implement it.
    • Gizmos for 3d-primitives are now implemented in GizmoPrimitive3d::gizmos(&self, &mut gizmos, isometry, color) which may be called on the primitive itself. i.e.
      Sphere::new(1.0).gizmos(&mut gizmos, Isometry3d::IDENTITY, RED)
      is now valid.
  • GizmoBuffer now implements a function primitive_3d<P: GizmoPrimitive3d > which can be used just like before.

Caveats

  • There is a lot of weird lifetime stuff going on.
  • You can call .gizmos(...) on primitives, which seems weird
  • If accepted, this needs to be repeated for 2d primitives.

Testing

  • Running the 3d_gizmos example

Migration Guide

  • For most use cases, this should not require migration, besides removing unused imports.
    • If you did implement GizmoPrimitive3d for a custom GizmoBuffer-like struct, you will need to move your implementation for custom primitives to the primitive itself and use that implementation in a seperate method on the previously mentioned struct.

@alice-i-cecile alice-i-cecile added C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide A-Gizmos Visual editor and debug gizmos S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 9, 2025
Copy link
Contributor

github-actions bot commented Jul 9, 2025

It looks like your PR is a breaking change, but you didn't provide a migration guide.

Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Gizmos Visual editor and debug gizmos C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GizmoPrimitiveNd for external primitives
2 participants