Skip to content

Instantly share code, notes, and snippets.

@Adidea
Created August 8, 2015 00:35
Show Gist options
  • Save Adidea/787f7ef14f60e286c581 to your computer and use it in GitHub Desktop.
Save Adidea/787f7ef14f60e286c581 to your computer and use it in GitHub Desktop.
function LookVector(surface, cframe)
local direction = {
["Front"] = cframe.lookVector;
["Back"] = cframe.lookVector*-1;
["Left"] = (cframe * CFrame.Angles(0, -math.pi/2, 0)).lookVector;
["Right"] = (cframe * CFrame.Angles(0, math.pi/2, 0)).lookVector;
["Top"] = (cframe * CFrame.Angles(math.pi/2, 0, 0)).lookVector;
["Bottom"] = (cframe * CFrame.Angles(-math.pi/2, 0, 0)).lookVector;
}
return direction[surface]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment