how to work with setHover? #49
-
In this script, when use setSelected(e) or setHover(true), the projected texture just disappeared, how to fix it to keep the texture always being there? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey, not sure why about 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 |
Beta Was this translation helpful? Give feedback.
-
hi marcofugaro, it works! thank you so much. |
Beta Was this translation helpful? Give feedback.
Hey, not sure why about
extend()
, but you can use ProjectedMaterial in r3f like thisSee the full demo here
https://codesandbox.io/s/basic-projected-material-test-forked-07u45e?file=/src/index.js:616-928