Occlusion Query: Usage without Inspector

Hey everybody,

I am currently trying to exclude the inspector from the production build in typescript (+webpack), however without importing the inspector occlusion queries don’t seem to work anymore. Adding


updates the isOccluded property of meshes. Without it, the value is always false.

I am probably missing an import for occlusion queries to work. Did anyone have the same issue?

Adding @RaananW :slight_smile: (our module master)


To get the occlusion functions you will need to import engine.occlusionQuery from core/engine/extensions . Are you importing it already?

Hi @RaananW,

yes I am importing engine.occlusionQuery already. I would provide a sandbox which reproduces the issue, however I believe it’s not possible to exclude the inspector in the sandbox?

No, it isn’t.

Want to share a minimized project that reproduces that? would be great!!

Ya sure, I will try to create one this evening.

1 Like

With the minimal version I am currently unable to reproduce this issue. This is really strange because in our project the only fix (I am aware of) is the above mentioned import statement. I will continue digging deeper and present my, hopefully successful, findings.

1 Like

It took a while but I was able to fix the issue by adding the following import statement:

import ‘@babylonjs/core’;

Edit: Our babylonjs package dependencies are:

“dependencies”: {
@babylonjs/core”: “^4.2.0-alpha.25”,
@babylonjs/gui”: “^4.2.0-alpha.25”,
@babylonjs/loaders”: “^4.2.0-alpha.25”,
@babylonjs/materials”: “^4.2.0-alpha.25”,

Edit2: A minimal project which reproduces this issue can be found here:

Thank you so much for the reproduction!

You are missing this:

import '@babylonjs/core/Rendering/boundingBoxRenderer';

This will cause it to work correctly :slight_smile:

1 Like