Advertisement
StefanBashkir

Return Surface Enum

Jun 10th, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. function GetSurface(part, pos)
  2.     local rel = part.CFrame:pointToObjectSpace(pos)
  3.     --if math.abs(rel.X) < part.Size.X  and math.abs(rel.Y) < part.Size.Y and math.abs(rel.Z) < part.Size.Z then
  4.     if math.abs(rel.Z) > math.abs(rel.Y) and math.abs(rel.Z) > math.abs(rel.X) then
  5.         if rel.Z > 0 then
  6.             return Enum.NormalId.Back
  7.         else
  8.             return Enum.NormalId.Front
  9.         end
  10.     elseif math.abs(rel.Y) > math.abs(rel.Z) and math.abs(rel.Y) > math.abs(rel.X) then
  11.         if rel.Y > 0 then
  12.             return Enum.NormalId.Top
  13.         else
  14.             return Enum.NormalId.Bottom
  15.         end
  16.     elseif math.abs(rel.X) > math.abs(rel.Z) and math.abs(rel.X) > math.abs(rel.Y) then
  17.         if rel.X > 0 then
  18.             return Enum.NormalId.Right
  19.         else
  20.             return Enum.NormalId.Left
  21.         end
  22.     end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement