How to create bounding boxes for all the models in a scene

I have a scene where my avatar is going inside the models and its movement is being hampered. I have used a bounding box and glad it is solving my problem.
But, I need bounding boxes for all the models in my scene. In my scene, I have a total of 42 models.
How can I add bounding boxes to all the models with less number of lines of code…?

Thanks in advance…

1 Like

Loops are your friend in these situations: Loops and iteration - JavaScript | MDN (mozilla.org) :slight_smile: You can access the list of all meshes on the scene with scene.meshes, and use for loops to do anything you want with them: Available Mesh Solar System | Babylon.js Playground (babylonjs.com)

2 Likes

This can be helpful too Drawing Bounding Boxes | Babylon.js Documentation

1 Like