how can i use fluidRenderer? #293
Unanswered
WachsenHaus
asked this question in
Q&A
Replies: 1 comment 1 reply
-
The easiest way right now would be to make a component and put it inside Something like (untested): import { useScene } from 'react-babylonjs';
export type FluidRenderType = {
enabled: boolean
}
export const FluidRenderer: FC<FluidRendererType> = ({enabled}) => {
const scene = useScene();
useEffect(() => {
if (enabled) {
const fluidRenderer = scene.enableFluidRenderer();
// do something with your fluid renderer.
// const renderObject = fluidRenderer.addParticleSystem(particleSystem);
} else {
scene.disableFluidRenderer();
}
}, [enabled]);
return null;
} You use like this: const [enabled, setEnabled] = useState(true);
...
<Scene ...>
<FluidRenderer enabled={enabled}
</Scene> You can also use the callbacks when the scene is created, but this will let you use your own component. |
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.
-
I am studying react-babylonjs. I want to use the fluid that exists in the official documentation of babylonjs, but is it not supported by react-babylonjs? Any help would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions