How do i get Part's Cframe angles

the title says its all, how to get the Part’s Cframe angle?

The CFrame consists of 12 numbers

x, y, z, R00, R01, R02, R10, R11, R12, R20, R21, R22

the first 3 numbers are the position vector
the last 9 numbers are the rotation matrix

the rotation matrix does not have any angles it has directions
this is what the directions look like

and each of these directions have a magnitude of 1 so there unit vectors

if we look at the documentation CFrame | Roblox Creator Documentation we can see that Roblox has provided us with functions called ToEulerAnglesXYZ() and ToEulerAnglesYXZ() we can use these functions to convert the rotation matrix to angles

local cFrame = CFrame.lookAt(Vector3.new(10, 7, 2), Vector3.new(8, 6, -20))
local eulerAngles = CFrame:ToEulerAnglesYXZ()
print(eulerAngles)

but most of the time its not good to work with euler angles due to gimble lock so its always better to work with the rotation matrix directly

5 Likes

What application do you need these angles for?