Update Parent Bounding Box On Child Added

You could detect reentrancy like this:

But it won’t work in your case because onAfterWorldMatrixUpdateObservable is called on the container before the parent property of the sphere is updated.

You can delay the execution of onAfterWorldMatrixUpdateObservable to the end of the frame, to let the code that set the parenting run:

2 Likes