Skip to content

🧪 Bone attachments #18262

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 11 commits into
base: main
Choose a base branch
from
Open

🧪 Bone attachments #18262

wants to merge 11 commits into from

Conversation

hukasu
Copy link
Contributor

@hukasu hukasu commented Mar 11, 2025

Objective

Starts work on #17114

Solution

Create a new crate bevy_bone_attachments and implement a extension trait on EntityCommands to allow attaching a new Scene to an Entity. The command then collects all AnimationTargets of the entity and copies it to the new Scene.

This is very early and only includes the above method, the new crate can also be included on an existing crate.

Testing

  • New example

Showcase

Bone attachments allow you to attach a mesh to another, think a character holding a weapon, or customizable clothing.

Experimental: The current state only allows attaching new scenes into models, and requires that the parent entity is already fully loaded (if it is also a scene, after its SceneInstance is ready) and have matching AnimationTargetIds.

Screencast_20250312_094221.webm

Use Guide

use bevy_bone_attachments::scene::SceneAttachmentExt;

// This requires that the parent is already fully loaded, and there is only a warning if it is not
commands
    .entity(parent)
    .attach_scene(
        asset_server.load_with_settings(
            GltfAssetLabel::Scene(0).from_asset("attachment.glb"),
            |settings: &mut GltfLoaderSettings| { settings.include_animation_target_ids = true; }
    ));

@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible A-Animation Make things move and change over time M-Needs-Release-Note Work that should be called out in the blog due to impact X-Controversial There is active debate or serious implications around merging this PR S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Mar 11, 2025
@hukasu
Copy link
Contributor Author

hukasu commented Mar 11, 2025

@alice-i-cecile any template on how to make the release note?

@alice-i-cecile
Copy link
Member

@alice-i-cecile any template on how to make the release note?

We're kind of in flux right now, but for now, putting a # Showcase section in the PR would be really helpful. The key points to hit are:

  • what new feature was introduced?
  • why is it important?
  • very briefly, how do you use it?

Copy link
Contributor

@viridia viridia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good generally. Note to @alice-i-cecile : this PR solves one of the two use cases mentioned in the original issue, so unless we want to split it into two separate tickets, it should not close the issue once merged.

@hukasu
Copy link
Contributor Author

hukasu commented Mar 11, 2025

Looks good generally. Note to @alice-i-cecile : this PR solves one of the two use cases mentioned in the original issue, so unless we want to split it into two separate tickets, it should not close the issue once merged.

that is why i wrote Starts work on #17114 instead of Closes

@hukasu
Copy link
Contributor Author

hukasu commented Mar 11, 2025

@alice-i-cecile given how early this is I think it is best to add Needs design

@pcwalton
Copy link
Contributor

Can someone help me understand why we can't just use BSN overrides for this? BSN should have the ability to say "I want to load scene X, but add my own custom entity as a child of object Y". That's core to the concept of what overrides are. Once we do that, this feature should naturally fall out, no?

@alice-i-cecile alice-i-cecile added S-Needs-Design This issue requires design work to think about how it would best be accomplished and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Mar 12, 2025
@hukasu
Copy link
Contributor Author

hukasu commented Mar 12, 2025

@pcwalton for skinned meshes there are other things needed for it to work, not just parenting, I'm preparing another model to actually show that this works for skinned meshes

@hukasu hukasu changed the title Bone attachments 🧪 Bone attachments Apr 18, 2025
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-Feature A new feature, making something new possible M-Needs-Release-Note Work that should be called out in the blog due to impact S-Needs-Design This issue requires design work to think about how it would best be accomplished X-Controversial There is active debate or serious implications around merging this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants