BoundingBoxRenderer breaking change in 8.22.3?

Hi,

after upgrading to v8.22.3 I’m getting following error:

scene.getBoundingBoxRenderer is not a function

on line 602 in packages/dev/core/src/Rendering/objectRenderer.ts:

const boundingBoxRenderer = scene.getBoundingBoxRenderer();

PR which introduced this code:

The error goes away when I instantiate BoundingBoxRenderer after Scene is created, however that would feel like a big breaking change for such a minor release.

Before reaching this workaround/solution, I tried to remove any babylonjs code containing substring bounding, but that didnt help. What other used features might be potentially causing this?

I am unable to reproduce this in playground yet, but if I’ll manage to do that, I’ll post an update here.

Thanks for any hint.

cc @Evgeni_Popov as author of the PR

You are totally right, @Evgeni_Popov I think we should not force the bbox renderer to be requested here ?

Can you do a PR for it or I ll create a fix tomorrow ?

This should fix it:

2 Likes

Thanks for the fix. While this indeed fix the error, it’s still somehow a breaking change which should be most likely addressed in the docs/changelog.

Previously the bounding box worked out of the box, now there needs to be an instance of BoundingBoxRenderer created to make it work.

For example the following page in docs:

It says that all you need to do is sphere.showBoundingBox = true;, which works in the playground (I assume BoundingBoxRenderer is somehow automagically created there?), but it doesnt work locally.

Just to be sure it’s not something in my project, I tried that with the following project template from Raanan, and it doesnt work there neither:

Do you import boundingBoxRenderer in your project? Something like import "@babylonjs/core/Rendering/boundingBoxRenderer";.

You do need this import to inject bounding box rendering support in Scene (it is not related to my previous PR, you need this import even in GitHub - RaananW/babylonjs-webpack-es6: Babylon.js basic scene with typescript, webpack, es6 modules, editorconfig, eslint, hot loading and more. Will even make coffee if you ask nicely. out of the box - that is, Babylon.js 8.2.1).

1 Like

Huh, you are right. I am now slightly bamboozled, because I was using bounding boxes for sure, as I was posting about them a few times in the forum already. But now I have noticed that I cant see them. I’m not sure what has changed. Grepping my git repo for boundingBoxRenderer shows that I was never using it, and yet the bounding boxes were working for me previously :thinking:

This is strange as we have it in the es6 doc from a long time https://doc.babylonjs.com/setup/frameworkPackages/es6Support:

I guess we may have introduced back the dependency inadvertently in the past.

1 Like

Don’t know why exactly, but I’m not using bounding boxes in my project and I got the error after updating to the latest dev version.

Importing boundingBoxRenderer did the trick but I am definitely not using showBoundingBox on any meshes…

This fix may be better, but it needs to be tested:

3 Likes