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

Use a consistent seed for AABB gizmo colors #9030

Merged
merged 1 commit into from
Jul 3, 2023

Conversation

nicopap
Copy link
Contributor

@nicopap nicopap commented Jul 3, 2023

Objective

The bounding box colors are from bevy_gizmo are randomized between app runs. This can get confusing for users.

Solution

Use a fixed seed with RandomState::with_seeds rather than initializing a AHash.
The random number was chose so that the first few colors are clearly distinct.

According to the RandomState::hash_one documentation, it's also faster.

bevy_bounding_box_colors_2023-07-03


Changelog

  • bevy_gizmo: Keep a consistent color for AABBs of identical entities between runs

This way, the same entities bounding box will have the same color
between runs.

The random number was chose so that the first few colors are clearly
distinct.
@nicopap nicopap added C-Enhancement A new feature A-Gizmos Visual editor and debug gizmos labels Jul 3, 2023
@nicopap nicopap added this to the 0.11 milestone Jul 3, 2023
@nicopap nicopap 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 Jul 3, 2023
@mockersf mockersf added this pull request to the merge queue Jul 3, 2023
Merged via the queue into bevyengine:main with commit 7aa0a47 Jul 3, 2023
24 checks passed
@nicopap nicopap deleted the static-gizmo-color branch August 30, 2023 13:39
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-Enhancement A new feature 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.

4 participants