Making BoundingInfo stick when resizing through BoundingBoxGizmo

Hi!

I’m implementing the BoundingBoxGizmo for the dragging scaling and rotating behaviors and it’s working out great. I did come across an issue where the dragging wouldn’t work for a plane object. This is probably because it has no thickness, so to remedy this I’ve changed the boundinginfo for this object.

This is all working, however when I then scale or rotate the plane it snaps back to the previous boundinginfo and I can’t get it back to how it was in the beginning.

Here’s a playground to illustrate the issue a bit better:

Does anyone know of a way to implement this to make either the new boundinginfo stick, or to make a plane draggable with the boudningboxgizmo without the new boundinginfo?

Thanks!

Hmm, I’ve found a workaround. It’s not great but it does work :smiley:

1 Like

Hello @HedwigAR , how are you doing?

An alternative solution for your problem might be to add an invisible cube as a child of the plane. This will force the bounding box to have correct values and you will not need to set them manually.

I did an update to your playground should the solution:
workaroud 2 BoundingBox for plane | Babylon.js Playground (babylonjs.com)

3 Likes

Ah good stuff! Thanks so much :smiley: