I have the following simple component that creates a scene with a cube and a gizmomanager:
export function Area3D() {
return (
<Engine antialias adaptToDeviceRatio>
<Scene>
<arcRotateCamera
name="camera1"
target={Vector3.Zero()}
alpha={Math.PI / 2}
beta={Math.PI / 4}
radius={8}
/>
<hemisphericLight
name="light1"
intensity={0.7}
direction={Vector3.Up()}
/>
<gizmoManager
positionGizmoEnabled={true}
usePointerToAttachGizmos={true}
/>
<box name="box1">
<standardMaterial
name="material1"
diffuseColor={Color3.FromHexString("#EEB5EB")}
/>
</box>
</Scene>
</Engine>
);
}
And then inside my app I render two instances of that component:
function App() {
return (
<>
<Area3D />
<Area3D />
</>
);
}
I would expect this to result in 2 completely independent scenes on two canvases.
What I actually get are two canvases that are linked with each other in some mysterious way. Like when I click the cube on the first canvas, the gizmo appears in the second canvas, like so:

When I then click the cube in second canvas I discover that I now got two gizmos, with one Gizmo controlling the cube in the first canvas and the other controlling the cube in other canvas.

It's not only a problem with gizmos. Various other things go wrong as well, like loading a model in one scene loads it also to another scene. This box with gizmo was just the simplest case I came up with, which seems to indicate some more fundamental issue here. Though the fundamental issue might just be in my lack of experience with 3D graphics.
This might be a problem with BabylonJS itself, though when I searched about this, I came away with a conclusion that it should be possible to have two engines running two different scenes on separate canvases. But I might have misinterpreted what I read.
PS. The goal in my actual app is to render two completely different scenes on two different canvases.
Using:
- react-babylonjs 3.2.2
- BabylonJS 7.42.0
- React 18.3.1
I have the following simple component that creates a scene with a cube and a gizmomanager:
And then inside my app I render two instances of that component:
I would expect this to result in 2 completely independent scenes on two canvases.
What I actually get are two canvases that are linked with each other in some mysterious way. Like when I click the cube on the first canvas, the gizmo appears in the second canvas, like so:
When I then click the cube in second canvas I discover that I now got two gizmos, with one Gizmo controlling the cube in the first canvas and the other controlling the cube in other canvas.
It's not only a problem with gizmos. Various other things go wrong as well, like loading a model in one scene loads it also to another scene. This box with gizmo was just the simplest case I came up with, which seems to indicate some more fundamental issue here. Though the fundamental issue might just be in my lack of experience with 3D graphics.
This might be a problem with BabylonJS itself, though when I searched about this, I came away with a conclusion that it should be possible to have two engines running two different scenes on separate canvases. But I might have misinterpreted what I read.
PS. The goal in my actual app is to render two completely different scenes on two different canvases.
Using: