User:NXTBoy/Scripts/Geometry/Plane: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>NXTBoy
New page: <nowiki>Plane = {} function Plane.new(p, normal) return setmetatable({ p = p, normal = normal }, { __index = Plane }); end function Plane.fromPartSurfaces(p) planes = {...
 
>NXTBoy
raw text now
 
Line 1: Line 1:
<nowiki>Plane = {}  
Plane = {}  
function Plane.new(p, normal)  
function Plane.new(p, normal)  
return setmetatable({  
return setmetatable({  
Line 21: Line 21:
end
end
_G.Plane = Plane
_G.Plane = Plane
--[[</nowiki><div></div>

Latest revision as of 15:52, 18 September 2011

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