pmndrs / drei

🥉 useful helpers for react-three-fiber
https://docs.pmnd.rs/drei
MIT License
8.36k stars 699 forks source link

Extend Sampler to use SkinnedMesh #1052

Open synergyseeker opened 2 years ago

synergyseeker commented 2 years ago

Describe the feature you'd like:

Currently the Sampler component expects a Mesh. Using skinnedMesh would allow keeping instancedMesh instances nicely anchored to the skin of an animated model. Effects such as particles, fur, etc that might be nice to move with a model could be possible.

Suggested implementation:

Sample code usage, would ideally be the same as using Mesh now.

<group ref={group} {...props} dispose={null}>
      <group name="Scene">
        <group name="MAN">
          <primitive object={nodes.mixamorigHips} />
          <Sampler count={3000}>
            <skinnedMesh
              name="Character_1"
              geometry={nodes.Character_1.geometry}
              material={nodes.Character_1.material}
              skeleton={nodes.Character_1.skeleton}
            >
            </skinnedMesh>
            <instancedMesh ref={ref} args={[null, null, 3000]}>
              <sphereGeometry args={[0.3, 8, 8]} />
              <meshBasicMaterial color={"#4455ff"} />
            </instancedMesh>
          </Sampler>
        </group>
      </group>
    </group>
github-actions[bot] commented 5 days ago

Thank you for contributing! We’re marking this issue as stale as a gentle reminder to revisit it and give it the attention it needs to move forward.

Any activity, like adding an update or comment, will automatically remove the stale label so it stays on our radar.

Feel free to reach out on Discord if you need support or feedback from the community. This issue will close automatically soon if there’s no further activity. Thank you for understanding and for being part of the project!