-
Notifications
You must be signed in to change notification settings - Fork 304
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
Attach objects to GTLF model bones component #294
Comments
@wmurphyrd any thoughts on this? Do you know of a component that already does it, or think there should be one? My first reaction would be that it's possibly better to have a component update the object's position on every frame without reparenting it, to match the bone's position. Similar to constraints in the physics system, but without the need for physics. Reparenting things dynamically has seemed more error prone and complex than needed in a lot of cases. |
Hi @donmccurdy. After attempting to use the above component in an actual project, it turns out that you were right that it was error prone and needlessly complicated. I took your advice and made it so that the objects I want to attach follow the position and rotation of the bones. It's a lot easier to work with. Here's the new one. Let me know if there's anything you think I can do to improve it. Thanks. AFRAME.registerComponent('attach-to-bone', {
}); |
@rexraptor08 do you have a working example anywhere? |
Hey! Can't get it to work. Can you explain how to use it? |
I wrote a component that lets you attach objects to GLTF model bones. It’s working great so far, but I was wondering if you wouldn’t mind taking a look at my code to see if there are any use cases I’m not considering or if it could be written more efficiently. Right now the component let’s you attach either another gltf model to a bone or an a-frame entity (like a-box for example). There’s even an option to trigger an animation clip to the attached gltf model.
It’s used like this:
The way I get the bone name is by looking at the bone names in blender. The gltf that gets exported from blender adds the prefix “Armature_” to the bone name. So for example, even though it might say “mixamorig_Head_2” in blender, the real name is “Armature_mixamorig_Head_2”.
Let me know what you think. I’d love to get your feedback.
The text was updated successfully, but these errors were encountered: