User:NXTBoy/Scripts/Geometry/Plane

From Legacy Roblox Wiki
Revision as of 16:21, 14 April 2011 by >NXTBoy (New page: <nowiki>Plane = {} function Plane.new(p, normal) return setmetatable({ p = p, normal = normal }, { __index = Plane }); end function Plane.fromPartSurfaces(p) planes = {...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Plane = {} function Plane.new(p, normal) return setmetatable({ p = p, normal = normal }, { __index = Plane }); end function Plane.fromPartSurfaces(p) planes = {} faces = {"Right", "Top", "Back", "Left", "Bottom", "Front"} for k, face in pairs(faces) do local normal = Vector3.fromNormalId(face) planes[k] = Plane.new(normal * p.Size / 2, normal):transformBy(p.CFrame) end return planes end function Plane:transformBy(cframe) return Plane.new(cframe:pointToWorldSpace(self.p), cframe:vectorToWorldSpace(self.normal)) end _G.Plane = Plane --[[