How do i get the region a model takes up?

i’ve searched through some documentation, but i can’t necessarily find anything to assist me. this is kind of what i am looking for.


*a function that takes a model, gets its min and max position in world space, and then spits out a region that represents that

if anybody could give me a prod in the right direction, that would be very helpful. thank you for your time

*dont mind my amazing writing skills with the mouse

You can use :GetBoundingBox.

thanks for your reply! the problem with boundingbox and extentssize is that it returns something like this
image

when i am looking for a function that can do this

Do you need to find that area for a model or just a part?

it isn’t exactly the area/volume. i’m looking for how to make a region based off of the min position and max position of the model but on the world axis. to answer your question, my code needs to support a model

i’m sorry if my explanations are a little hard to understand. try to look at my reference pictures

Get the position of every corner in your model, and put it into a table.

Then find the lowest position, the highest position, the most north position, etc to generate height, width, and length.

You can position the part in the middle of the model, and size it accordingly with the values you generated.

ahh, that seems a tiny bit expensive, though. this function is meant to be run every frame at some times. i guess i could try doing it outside of a table. i’ll tell you how it turns out.

There’s a lot of optimizations you can do by only searching parts the furthest from the center for example.

Not expensive at all unless you’re doing it for many parts, which would just be bad design. Its all super simple operations, cpu’s chew through them at a lightning rate.

Heres some implementations you can work off of

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.