Skip to content

how to work with setHover? #49

Answered by marcofugaro
wujunbao1963 asked this question in Q&A
Discussion options

You must be logged in to vote

Hey, not sure why about extend(), but you can use ProjectedMaterial in r3f like this

const ProjectedMaterial = React.forwardRef(
  ({ camera, texture, ...props }, ref) => {
    const material = useMemo(
      () => new ProjectedMaterialImpl({ camera, texture }),
      [camera, texture]
    );
    return (
      <primitive object={material} ref={ref} attach="material" {...props} />
    );
  }
);

See the full demo here
https://codesandbox.io/s/basic-projected-material-test-forked-07u45e?file=/src/index.js:616-928

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by wujunbao1963
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants