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

Method:

local CF = CFrame.new(Part1.Position,Part2.Position) -- CFrame with a position of Part1, facing Part2
local X, Y, Z = CF:ToOrientation() -- Gets Orientation from CFrame
-- X, Y, Z are radians.
11 Likes