Getting a bounding box from a group of individal parts

Hey DevForum, hopefully you guys are having a good day. I’ve come across needing a bounding box over x amount of models with primary parts but I don’t really have an idea on what I could do, any tips, advice, solutions you could throw my way? Sorry if this is a bit vague, I’ll answer any questions about my question if needed.

1 Like

Are you asking that you would need the selection box around models? Perhaps images could help to better understand what you mean.

Its kind of late, tommorow I’ll reply with a picture. I was trying to say I’m trying to get the bounding box of an array of models. Similar to when you select a model, it creates a bounding box.

Create a model, place all parts inside of it, use model:GetBoundingBox() that returns a cframe and a vector3, unparent the models to their previous parents, and delete the model

2 Likes

Models now have a :GetBoundingBox() method. If you want to get the bounding box of all the parts and models in the array, you could create a new model in the script, put all the parts/models into that model, and then use :GetBoundingBox() on the created model. Then you can reparent everything to its original parent and delete the model.

1 Like

I basically just said that lol

6 Likes

I’ve considered that, but is there any way that dosen’t involve you adding all the models into a model?

No, because then you’d have to hardcode the points you want as your bounding boxes.

No, but that method is your best bet.

I started typing before you so I didn’t see your post till after I posted. I was on mobile so I was typing kinda slow too

1 Like

If you don’t want to mess with the original parts for some reason, just clone them and group them together.