Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Script made by Oysi
- local pointToObjectSpace = CFrame.new().pointToObjectSpace
- local vectorToWorldSpace = CFrame.new().vectorToWorldSpace
- local v1 = Vector3.new(-1, 0, 0)
- local v2 = Vector3.new( 1, 0, 0)
- local v3 = Vector3.new(0, -1, 0)
- local v4 = Vector3.new(0, 1, 0)
- local v5 = Vector3.new(0, 0, -1)
- local v6 = Vector3.new(0, 0, 1)
- function getNormal(part, pos)
- local dif = pointToObjectSpace(part.CFrame, pos) / part.Size
- if dif.x < -0.499 then return vectorToWorldSpace(part.CFrame, v1)
- elseif dif.x > 0.499 then return vectorToWorldSpace(part.CFrame, v2)
- elseif dif.y < -0.499 then return vectorToWorldSpace(part.CFrame, v3)
- elseif dif.y > 0.499 then return vectorToWorldSpace(part.CFrame, v4)
- elseif dif.z < -0.499 then return vectorToWorldSpace(part.CFrame, v5)
- elseif dif.z > 0.499 then return vectorToWorldSpace(part.CFrame, v6)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement