How to remove the boundingbox?

Hi all (@trevordev)
I have my meshes wrapped with a boundingbox using the MakeNotPickableAndWrapInBoundingBox command. At some stage using a JS function I need to clone the wrapped mesh.Therefore I need to remove the boundingbox. How do I do that ?

I have created a PG scenario, where if I click anywhere outside the boundingbox mesh, the boundingbox with it’s gizmo should be removed. What is the command if any exists?

Well this cannot work:

@Jacob you should be able to do wrappedObject.setParent(null)

See Babylon.js Playground

1 Like


As you can see from the PG sample, that setParent(null) does NOT do the job. On the screen it’s still the bounding box and not the wrapped mesh…

pinging @Cedric as well

I’m taking a look


setParent will unparent the sphere and the bounding box but the bounding box is still in the scene and clickable. so if you click on the sphere, the raycast will pick the bounding box.
I didn’t manage to filter the raycast to not pick the bounding box. Doing that:


I get the sphere picked. But You have to recreate the bounding box after.


dispose() in addotion to setParent does the job and YES the bounding box needs to be recreated