Skip to content
Discussion options

You must be logged in to vote

I think your best bet is to do the mesh sampling imperatively in a useEffect() or useMemo()

It's pretty common to work imperatively when working with instanced meshes.

Basically, you'd setup the mesh sampler by passing a reference to a mesh into it. Then, in useFrame or useEffect, adding/updating the meshes to the sampled points.

You could generalize this to a component to reuse.

<MeshSampler meshesToInstance={[array of meshes]}>
   <MeshToSample />
</MeshSampler>

I'll see if I can squeeze in an example today.

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@mwmwmw
Comment options

@RedPandore
Comment options

@emalorenzo
Comment options

@drcmda
Comment options

@emalorenzo
Comment options

Answer selected by RedPandore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants