# Customizable Utility Layer for Physics Viewer

**URL:** <https://forum.babylonjs.com/t/customizable-utility-layer-for-physics-viewer/57591>\
**Category:** Completed Features\
**Tags:** inspector, physics, utilitylayerrenderer, physicsshape\
**Created:** [April 3, 2025, 7:27am UTC](https://forum.babylonjs.com/t/customizable-utility-layer-for-physics-viewer/57591 "2025-04-03T07:27:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tapanij](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tapanij/32/50936_2.png) [@tapanij](https://forum.babylonjs.com/u/tapanij)\
**Post date:** [April 3, 2025, 7:27am UTC](https://forum.babylonjs.com/t/customizable-utility-layer-for-physics-viewer/57591/1 "2025-04-03T07:27:26Z")

</div>

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:

> <https://github.com/BabylonJS/Babylon.js/blob/7b3c5fa731531f7898a256dd87ce341fa02e0427/packages/dev/core/src/Debug/physicsViewer.ts#L92>

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:

```typescript
// @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:

1. Provide a public method in the physics viewer to set a custom utility layer or renderCamera.
2. 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.

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [April 3, 2025, 8:03am UTC](https://forum.babylonjs.com/t/customizable-utility-layer-for-physics-viewer/57591/2 "2025-04-03T08:03:26Z")

</div>

Change should not be too complicated to do. Let me see if I can do something 🙂

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [April 3, 2025, 8:52am UTC](https://forum.babylonjs.com/t/customizable-utility-layer-for-physics-viewer/57591/3 "2025-04-03T08:52:06Z")

</div>

> <https://github.com/BabylonJS/Babylon.js/pull/16442>
>
> follow up
> https://forum.babylonjs.com/t/customizable-utility-layer-for-physics-…viewer/57591/2
> https://forum.babylonjs.com/t/boundinginfohelper-dispose/57588/2

---

<div class="post-metadata">

**Author:** ![tapanij](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tapanij/32/50936_2.png) [@tapanij](https://forum.babylonjs.com/u/tapanij)\
**Post date:** [April 4, 2025, 6:35am UTC](https://forum.babylonjs.com/t/customizable-utility-layer-for-physics-viewer/57591/4 "2025-04-04T06:35:22Z")

</div>

Perfect! I just tested the fix and the issue is completely resolved now, thank you!
