EffectsComposer effect update based on mouse position #595
robksawyer
started this conversation in
General
Replies: 2 comments 2 replies
-
const ref = useRef()
useFrame(state => {
ref.current.xyz = state.mouse.x // normalized (-1/0/1), centralized mouse coords
})
return <foo ref={ref} /> this way you can also write uniforms: |
Beta Was this translation helpful? Give feedback.
1 reply
-
in theory yes but i dont know if the lib supports it or if you need to call something for it to update. it doesnt seem to do anything. shaders normally communicate through uniforms, so setting a value on the class does nothing, unless that value is a getter/setter that reads and writes into the uniform, as it normally should be. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
What's the best practice for updating an effect within the EffectsComposer lib from 'drei'?
Something like this...
Beta Was this translation helpful? Give feedback.
All reactions