Hi. I have a setup where I use a separate camera for Babylon GUI along with a normal ArcCamera. When I enable the physics viewer from the inspector, it doesn’t display because the viewer creates a new utility layer and assigns the GUI camera by default, which isn’t suitable for rendering 3D objects. You can see the relevant code here:
I could create my own physics viewer, but since the utility layer is set to private, there’s no official way to set a custom renderCamera or utility layer without resorting to hacks like:
// @ts-ignore
this.physicsViewer._utilityLayer.setRenderCamera(this.arcCamera);
// alternative hack, same result
// this.physicsViewer._utilityLayer = UtilityLayerRenderer.DefaultUtilityLayer;
I would like to propose the following solutions:
- Provide a public method in the physics viewer to set a custom utility layer or renderCamera.
- Modify the physics viewer to use UtilityLayerRenderer.DefaultUtilityLayer or UtilityLayerRenderer.DefaultKeepDepthUtilityLayer so that the renderCamera can be set externally.
Thank you for considering this request.