How To Get Orientation From CFrame?

How would I find the V3 orientation from a CFrame? I.e;

Question #1

local CF = CFrame.new(Part1.Position,Part2.Position) -- CFrame with a position of Part1, facing Part2
local Orientation = CF.Orientation -- I know there is no Orientation property of CFrame, but it's an example of what I'm looking for

Question #2

Using only CFrame manipulation, how would I limit how much a CFrame can be angled? For example making it so this eyeball cannot rotate past these two red parts;

This all without using the Orientation part property.

I believe for question #1, it’s CFrame.LookVector. I’m not sure about the other question though, sorry.

1 Like

Here use this code:

local cframe = Instance.new('Part')
cframe.CFrame = Part.CFrame -- what cframe
print(cframe.Orientation) -- prints the orientation of the new part created in Instance.new()

This will not get the part’s orientation, However this will get the new part’s orientation

Method 2:

local CF = CFrame.new(Part1.Position,Part2.Position) -- CFrame with a position of Part1, facing Part2
local Orientation = CF:ToOrientation() -- Gets Orientation from CFrame
6 Likes