-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Example for axes gizmos #12299
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
Example for axes gizmos #12299
Conversation
It might be nicer to show how to create automatically scaled axes in this example, rather than customizing the length, but I don't feel strongly. |
How about adding another box with other set of axes? Then we could have both |
Good idea! I'll size the axes based on the |
I tried this out, but I felt that playing with the axis sizing detracted from the demonstration of the tool's main utility (drawing axes on objects for debugging) so I tried to do a good job of just demonstrating automatically sized axes instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good example, showing the user that they can go very far with this feature!
# Objective - Improve example from #12299 - Make it frame rate independent - Make it not randomly random ## Solution - Transitions between transforms will take 2 seconds instead of 100 frames - Random is seeded
# Objective - Follow-up to bevyengine#12211 - Introduces an example project that demonstrates the implementation and behavior of `Gizmos::axes` for an entity with a `Transform` component. ## Solution In order to demonstrate how `Gizmo::axes` can be used and behaves in practice, we introduce an example of a simple scene containing a pair of cuboids locked in a grotesque, inscrutable dance: the two are repeatedly given random `Transform`s which they interpolate to, showing how the axes move with objects as they translate, rotate, and scale. <img width="1023" alt="Screenshot 2024-03-04 at 1 16 33 PM" src="https://github.com/bevyengine/bevy/assets/2975848/c1ff4794-6722-491c-8522-f59801645139"> On the implementation side, we demonstrate how to draw axes for entities, automatically sizing them according to their bounding boxes (so that the axes will be visible): ````rust fn draw_axes(mut gizmos: Gizmos, query: Query<(&Transform, &Aabb), With<ShowAxes>>) { for (&transform, &aabb) in &query { let length = aabb.half_extents.length(); gizmos.axes(transform, length); } } ```` --- ## Changelog - Created examples/gizmos/axes.rs. - Added 'axes' example to Cargo.toml.
# Objective - Improve example from bevyengine#12299 - Make it frame rate independent - Make it not randomly random ## Solution - Transitions between transforms will take 2 seconds instead of 100 frames - Random is seeded
# Objective - Follow-up to bevyengine#12211 - Introduces an example project that demonstrates the implementation and behavior of `Gizmos::axes` for an entity with a `Transform` component. ## Solution In order to demonstrate how `Gizmo::axes` can be used and behaves in practice, we introduce an example of a simple scene containing a pair of cuboids locked in a grotesque, inscrutable dance: the two are repeatedly given random `Transform`s which they interpolate to, showing how the axes move with objects as they translate, rotate, and scale. <img width="1023" alt="Screenshot 2024-03-04 at 1 16 33 PM" src="https://github.com/bevyengine/bevy/assets/2975848/c1ff4794-6722-491c-8522-f59801645139"> On the implementation side, we demonstrate how to draw axes for entities, automatically sizing them according to their bounding boxes (so that the axes will be visible): ````rust fn draw_axes(mut gizmos: Gizmos, query: Query<(&Transform, &Aabb), With<ShowAxes>>) { for (&transform, &aabb) in &query { let length = aabb.half_extents.length(); gizmos.axes(transform, length); } } ```` --- ## Changelog - Created examples/gizmos/axes.rs. - Added 'axes' example to Cargo.toml.
Objective
Gizmos::axes
for an entity with aTransform
component.Solution
In order to demonstrate how
Gizmo::axes
can be used and behaves in practice, we introduce an example of a simple scene containing a pair of cuboids locked in a grotesque, inscrutable dance: the two are repeatedly given randomTransform
s which they interpolate to, showing how the axes move with objects as they translate, rotate, and scale.On the implementation side, we demonstrate how to draw axes for entities, automatically sizing them according to their bounding boxes (so that the axes will be visible):
Changelog