Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I get a Region3 representing the volume of a part?

Asked by 7 years ago

I have a part where I would like to get the Region3 of the area inside of it. How can I do this using the part's properties (size, position and CFrame)? There is not a simple constructor for Region3s where you can just provide position and size, so I am confused how to calculate the two vector3s needed to make a region3, from a part's position cfame and size. Yes, I can place a brick at the corners of the part, and use that to figure out the Region3, however I would like to know how to do this from a script. Hopefully my question isn't too confusing.

1 answer

Log in to vote
2
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
7 years ago

You can use part.CFrame*(part.Size/2) and part.CFrame*(-part.Size/2) to get 2 opposite corners. If the part is rotated by something other than multiples of 90 degrees, though, then the resulting region will still represent an un-rotated box from one corner to the other.

Ad

Answer this question