-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Split up animated_fox
example
#17191
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Carter0
approved these changes
Jan 6, 2025
alice-i-cecile
approved these changes
Jan 6, 2025
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.
I like the split a lot, but I think we should rename these examples to not refer to foxes. That's an implementation detail that doesn't matter to learners :)
alice-i-cecile
added
C-Examples
An addition or correction to our examples
S-Ready-For-Final-Review
This PR has been approved by the community. It's ready for a maintainer to consider merging it
A-Animation
Make things move and change over time
labels
Jan 6, 2025
BenjaminBrienen
approved these changes
Jan 6, 2025
greeble-dev
added a commit
to greeble-dev/bevy
that referenced
this pull request
Jan 9, 2025
- One function does the animation setup that we're demonstrating. - The other function does the incidental things like spawning the environment. - Changed the animation playing to use AnimationPlayer directly instead of creating AnimationTransitions. - This appears sufficient when only playing a single animation. - The animated_mesh_controls example will demonstrate multiple animations and AnimationTransitions. - Changed the animation asset to be the run cycle. - The original animated_fox example used the run. - I think this got accidentally changed in bevyengine#17191, so reverting to the original is safest. - Changed FOX_PATH to a more neutral ASSET_PATH. - Removed a seemingly redundant AnimationGraphHandle component. - Added and updated various comments.
greeble-dev
added a commit
to greeble-dev/bevy
that referenced
this pull request
Jan 9, 2025
- Split the setup function in two. - One function does the animation setup that we're demonstrating. - The other function does the incidental things like spawning the environment. - Changed the animation playing to use AnimationPlayer directly instead of creating AnimationTransitions. - This appears sufficient when only playing a single animation. - The animated_mesh_controls example will demonstrate multiple animations and AnimationTransitions. - Changed the animation asset to be the run cycle. - The original animated_fox example used the run. - I think this got accidentally changed in bevyengine#17191, so reverting to the original is safest. - Changed FOX_PATH to a more neutral ASSET_PATH. - Removed a seemingly redundant AnimationGraphHandle component. - Added and updated various comments.
greeble-dev
added a commit
to greeble-dev/bevy
that referenced
this pull request
Jan 9, 2025
- Split the setup function in two. - One function does the animation setup that we're demonstrating. - The other function does the incidental things like spawning the environment. - Changed the animation playing to use AnimationPlayer directly instead of creating AnimationTransitions. - This appears sufficient when only playing a single animation. - The animated_mesh_controls example will demonstrate multiple animations and AnimationTransitions. - Changed the animation asset to be the run cycle. - The original animated_fox example used the run. - I think this got accidentally changed in bevyengine#17191, so reverting to the original is safest. - Changed FOX_PATH to a more neutral ASSET_PATH. - Removed a seemingly redundant AnimationGraphHandle component. - Added and updated various comments. - Changed the example description to mention the fox. - This is a small hint that the example relates to character animation, as opposed to the more bare-bones examples.
greeble-dev
added a commit
to greeble-dev/bevy
that referenced
this pull request
Jan 9, 2025
- Split the setup function in two. - One function does the animation setup that we're demonstrating. - The other function does the incidental things like spawning the environment. - Changed the animation playing to use AnimationPlayer directly instead of creating AnimationTransitions. - This appears sufficient when only playing a single animation. - The animated_mesh_controls example will demonstrate multiple animations and AnimationTransitions. - Changed the animation asset to be the run cycle. - The original animated_fox example used the run. - I think this got accidentally changed in bevyengine#17191, so reverting to the original is safest. - Changed FOX_PATH to a more neutral ASSET_PATH. - Removed a seemingly redundant AnimationGraphHandle component. - Added and updated various comments. - Changed the example description to mention the fox. - This is a small hint that the example relates to character animation, as opposed to the more bare-bones examples.
greeble-dev
added a commit
to greeble-dev/bevy
that referenced
this pull request
Jan 9, 2025
- Split the setup function in two. - One function does the animation setup that we're demonstrating. - The other function does the incidental things like spawning the environment. - Changed the animation playing to use AnimationPlayer directly instead of creating AnimationTransitions. - This appears sufficient when only playing a single animation. - The animated_mesh_controls example will demonstrate multiple animations and AnimationTransitions. - Changed the animation asset to be the run cycle. - The original animated_fox example used the run. - I think this got accidentally changed in bevyengine#17191, so reverting to the original is safest. - Changed FOX_PATH to a more neutral ASSET_PATH. - Removed a seemingly redundant AnimationGraphHandle component. - Added and updated various comments. - Changed the example description to mention the fox. - This is a small hint that the example relates to character animation, as opposed to the more bare-bones examples.
greeble-dev
added a commit
to greeble-dev/bevy
that referenced
this pull request
Jan 11, 2025
- The original animated_fox example used the run. - I think this got accidentally changed in bevyengine#17191, so reverting to the original is safest. - Note that we can improve this to select the animation by name if bevyengine#16529 lands.
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jan 14, 2025
# Objective Building upon #17191, improve the `animated_mesh` example by removing code, adding comments, and making the example more c&p'able. ## Solution - Split the setup function in two to clarify what the example is demonstrating. - `setup_mesh_and_animation` is the demonstration. - `setup_camera_and_environment` just sets up the example app. - Changed the animation playing to use `AnimationPlayer` directly instead of creating `AnimationTransitions`. - This appears sufficient when only playing a single animation. - Added a comment pointing users to an example of multiple animations. - Changed the animation to be the run cycle. - I think it got accidentally changed to the idle in [#17191](#17191), so this is reverting back to the original. - Note that we can improve it to select the animation by name if [#16529](#16529) lands. - Renamed `FOX_PATH` to a more neutral `GLTF_PATH`. - Updated the example descriptions to mention the fox. - This adds a little character and hints that the example involves character animation. - Removed a seemingly redundant `AnimationGraphHandle` component. - Removed an unnecessary `clone()`. - Added various comments. ## Notes - A draft of this PR was discussed on Discord: https://discord.com/channels/691052431525675048/1326910663972618302/1326920498663133348 - There was discord discussion on whether a component is "inserted onto", "inserted into" or "added to" an entity. - "Added to" is most common in code and docs, and seems best to me. But it awkwardly differs from the name of `EntityCommands::insert`. - This PR prefers "added to". - I plan to follow up this PR with similar changes to the `animated_mesh_control` and `animated_mesh_events` examples. - But I could roll them into this PR if requested. ## Testing `cargo run --example animated_mesh` --------- Co-authored-by: François Mockers <mockersf@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-Animation
Make things move and change over time
C-Examples
An addition or correction to our examples
S-Ready-For-Final-Review
This PR has been approved by the community. It's ready for a maintainer to consider merging it
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Our
animated_fox
example used to be a bare-bones example of how to spawn an animated gltf and play a single animation.I think that's a valuable example, and the current
animated_fox
example is doing way too much. Users who are trying to understand how our animation system are presented with an enormous amount of information that may not be immediately relevant.Over the past few releases, I've been migrating a simple app of mine where the only animation I need is a single gltf that starts playing a single animation when it is loaded. It has been a slight struggle to wade through changes to the animation system to figure out the minimal amount of things required to accomplish this.
Somewhat motivated by this recent reddit thread where Bevy and animation got a mention.
Solution
animated_fox
into three separate examplesanimated_fox
- Loads and immediately plays a single animationanimated_fox_control
- Shows how to control animationsanimated_fox_events
- Shows fancy particles when the fox's feet hit the groundI have created this PR after playing around with the idea and liking how it turned out, but the duplication isn't totally ideal and there's some slight overlap with other examples and inconsistencies:
animation_events
is simplified and not specific to "loaded animated scenes" and seems valuable on its ownanimation_graph
also uses a foxI am happy to close this if there's no consensus that it's a good idea / step forward for these examples.
Testing
cargo run --example animated_fox
cargo run --example animated_fox_control
cargo run --example animated_fox_events