BoundingBoxGizmo issues when attached to abstract mesh

This issue is not present in the latest, so it appears to be a bug in 4.2.1. My question is if there is a workaround for 4.2.1 as we are trying to hold off on updating until our next release.

If you run the attached PG in latest, you get the expected result, which is a bounding box gizmo that uses the bounds of the entire hierarchy. If you run it in 4.2.1, on initial load you see the bounding box gizmo but get an error that a scene must be specified. If you hit play after that, you get no error, but the bounding box doesn’t show, which is what I am seeing in my app. I tried serializing both gizmos to json and comparing them, but the size of the object as json chokes editors and diff tools.

Is there a way to run a playground using a specified version of babylon js? No idea how to debug this otherwise.

Yeah. There is a version select on the upper right.

Gotcha, thanks.

So this is happening at this line here in babylon.manager.js (formatted):
e.RegisterClass("BABYLON.UniversalAlbedoMaterial", a)
The problem is that RegisterClass does not exist on the BABYLON module at run time.

Since you’re just looking for a temp fix between releases, can you do something like this:
BABYLON.RegisterClass = () => true
Where you would add this line in your code wherever it is that you first import babylon. I’m pretty sure the gizmo you’re using doesn’t really need it since it seems to work the first time your sandbox loads.

Thanks. Turns out I was telling the gizmo to ignoreChildren because of some UI stuff I was playing with earlier. So since my root mesh had no geometry, the bounds were 0. Once I removed ignoreChildren, my BB Gizmo showed up. It occurs to me it is much better to use the predicate than the broad axe that is ignore children in any case. I have no idea why it doesn’t work in the PG, which did not have ignoreChildren.

1 Like