Skip to content

Instantly share code, notes, and snippets.

@daily3014
Last active March 9, 2026 14:56
Show Gist options
  • Select an option

  • Save daily3014/1ce2b2ae772add0ff1ce5a9998c19842 to your computer and use it in GitHub Desktop.

Select an option

Save daily3014/1ce2b2ae772add0ff1ce5a9998c19842 to your computer and use it in GitHub Desktop.
GetExtentsSize for Parts
-- Original from https://devforum.roblox.com/t/getextentssize-of-one-part-without-model/404945/7
-- 300% faster than original
-- 12.5% faster than forks claiming to be 20% faster
--!native
--!optimize 2
--!strict
local Abs, New = math.abs, Vector3.new
local Components = CFrame.identity.GetComponents
local function GetPartExtentsSize(Part: BasePart): Vector3
local _, _, _,
R00: number, R01: number, R02: number,
R10: number, R11: number, R12: number,
R20: number, R21: number, R22: number = Components(Part.CFrame)
local Size: Vector3 = Part.Size
local SX: number, SY: number, SZ: number = Size.X, Size.Y, Size.Z
return New(Abs(R00), Abs(R10), Abs(R20)) * SX
+ New(Abs(R01), Abs(R11), Abs(R21)) * SY
+ New(Abs(R02), Abs(R12), Abs(R22)) * SZ
end
-- Example
local Part = workspace.Baseplate
local Size: Vector3 = GetPartExtentsSize(Part)
@AstonishedLiker
Copy link

Where are the unit tests daily?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment