Created
August 26, 2022 11:02
-
-
Save devSparkle/5a59d769a1dcf9e8d57f98ab768da0bc to your computer and use it in GitHub Desktop.
Calculate Polygon Center
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for _, Polygon: Model in next, game.Selection:Get() do | |
if not Polygon:IsA("Model") then continue end | |
local Center = Vector3.zero | |
local Children = Polygon:GetChildren() | |
for _, Child: BasePart in next, Children do | |
if not Child:IsA("BasePart") then continue end | |
Center += Child.Position | |
end | |
Center /= #Children | |
Polygon.WorldPivot = (Polygon.WorldPivot - Polygon.WorldPivot.Position) + Center | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment