Last active
December 30, 2023 07:48
-
-
Save gaymeowing/bc32b5295224026d31c477fe012d3c0d to your computer and use it in GitHub Desktop.
Utility function for getting all of a box's corner CFrames
This file contains hidden or 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
--!strict | |
-- GetBoxCorners | |
-- Simple function for getting all of an objects corners | |
-- Modified From: https://github.com/FrostDracony/Roblox/blob/master/Tutorials/GetCornersOfAllBaseParts/GetCornersOfPart.md | |
-- @Kalrnlo | |
-- 25/10/2023 | |
return function(BoxSize: Vector3, BoxCFrame: CFrame?) | |
local BoxCFrame = BoxCFrame or CFrame.new() | |
return { | |
TopUnderRightCorner = BoxCFrame * CFrame.new(-BoxSize.X/2, BoxSize.Y/2, -BoxSize.Z/2), | |
TopUpperRightCorner = BoxCFrame * CFrame.new(-BoxSize.X/2, BoxSize.Y/2, BoxSize.Z/2), | |
BottomUpperRightCorner = BoxCFrame * CFrame.new(-BoxSize/2), | |
BottomUnderLeftCorner = BoxCFrame * CFrame.new(BoxSize.X/2 , -BoxSize.Y/2 , BoxSize.Z/2), | |
BottomUpperLeftCorner = BoxCFrame * CFrame.new(BoxSize.X/2 , -BoxSize.Y/2 , -BoxSize.Z/2), | |
TopUnderLeftCorner = BoxCFrame * CFrame.new(BoxSize.X/2 , BoxSize.Y/2 , -BoxSize.Z/2), | |
TopUpperLeftCorner = BoxCFrame * CFrame.new(BoxSize/2), | |
BottomUnderRightCorner = BoxCFrame * CFrame.new(-BoxSize.X/2 , -BoxSize.Y/2 , BoxSize.Z/2), | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment