As a developer, I want to move several models next to each other such that their bounding boxes are touching.
The models are arbitrary from a large preset list and all have different proportions but have PrimaryPart set, so :GetExtentsSize() works, but I want to know the relationship between the center of the bounding box returned by GetExtentsSize and the position of the PrimaryPart.
For an illustration, I am looking for the red vector in this diagram:
EDIT: moved from Scripting Support to Engine Features
I know it’s deprecated, but why not use
model:GetModelCFrame() and calculate the difference from the primary part position to the corner of the model with the model CFrame and extents size?
Roblox is working on adding a new function called GetBoundingBox, which returns the CFrame and Size of the bounding box of a model. Once this comes out, simply use
ModelCF, ModelSize = Model:GetBoundingBox()
Offset = Model.PrimaryPart.Position-ModelCF.p
The new function is listed here, shown as still pending.
Alternatively you can use the deprecated method usering suggested, since it still appears to work.
Oh wow I didn’t even know about that. Roblox is adding everything that I have been working around for the past week or so all of the sudden
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.