Created
December 30, 2023 05:18
-
-
Save gaymeowing/e8e3afa71152ab2457f57adba0c41fa7 to your computer and use it in GitHub Desktop.
Utility function for getting CFrames for every side of a box
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 | |
-- GetBoxSides | |
-- Simple function for getting all of a box's sides | |
-- Modified From: https://devforum.roblox.com/t/how-do-i-find-the-top-and-bottom-of-a-part/1082206 | |
-- @Kalrnlo | |
-- 25/10/2023 | |
return function(BoxSize: Vector3, BoxCFrame: CFrame?) | |
local BoxCFrame = BoxCFrame or CFrame.new() | |
return { | |
Top = BoxCFrame * CFrame.new(0, BoxSize.Y / 2, 0), | |
Bottom = BoxCFrame * CFrame.new(0, BoxSize.Y / -2, 0), | |
Front = BoxCFrame * CFrame.new(0, 0, BoxSize.Z / -2), | |
Back = BoxCFrame * CFrame.new(0, 0, BoxSize.Z / 2), | |
Left = BoxCFrame * CFrame.new(BoxSize.X / -2, 0, 0), | |
Right = BoxCFrame * CFrame.new(BoxSize.X / 2, 0, 0), | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment