Bone attachment

From verekia/r3f-gamedev · View interactive version

Bone attachment is an AI agent skill from the GitHub repository verekia/r3f-gamedev. Attach meshes to bones of a skinned mesh, such as attaching a sword to a character's hand.

How to use this skill

Skill file

Bone Attachment

Attach meshes to bones of a skinned mesh, such as attaching a sword to a character's hand.

Technique

Create a BoneChild component that uses useEffect to add a container group to a bone and remove it on cleanup. The bone reference is obtained from the GLTF nodes after loading the model.

Key Concepts

Usage

const { nodes } = useGLTF('/character.glb')

<BoneChild bone={nodes.HandR} position={[0, 0.3, 2]} rotation={[0, 0, 0]}>
  <mesh>
    <boxGeometry />
    <meshBasicMaterial color="red" />
  </mesh>
</BoneChild>

This skill is part of verekia's **r3f-gamedev**.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.