Closed lawplatform closed 1 year ago
I know normal way to detachControl
camera.inputs.attached.mouse.detachControl();
however, How to I put the code in the raect-babylonjs ?
<div style={{ flex: 1, display: 'flex' }}> <Engine antialias adaptToDeviceRatio canvasId="babylon-canvas"> <Scene> <freeCamera name="camera1" position={new Vector3(0, 5, -10)} setTarget={[Vector3.Zero()]} detachControl=true /> <hemisphericLight name="light1" intensity={0.7} direction={new Vector3(0, 1, 0)} /> {children}</Scene> </Engine> </div
I found it :)
useEffect(() => { if (scene?.activeCamera != null) { scene.activeCamera.inputs.attached.mouse.detachControl(); } }, [])
I know normal way to detachControl
camera.inputs.attached.mouse.detachControl();
however, How to I put the code in the raect-babylonjs ?