How to convert CFrame to Orientation

How could you convert a CFrame into a pure orientation Vector3, just like baseparts have?
I have tried every CFrame manipulation, but no results.

You can use cframe:ToOrientation(). Careful though, because that will return the orientation in radians, whereas Orientation for parts is shown in degrees. So you will need to transform it:

local rx, ry, rz = cframe:ToOrientation()
local dx, dy, dz = math.deg(rx), math.deg(ry), math.deg(rz)

-- In vector3 format:
local orientation = Vector3.new(dx, dy, dz)

Edit: Fixed variable names

10 Likes

Thats position not orientation both use vector3s

I am using a script inside the player and a random part in the workspace.

local HumanoidRootPartPos = script.Parent.HumanoidRootPart.Position
local RandomPart = game.workspace.TestingPart
local NewRotation = Vector3.new(HumanoidRootPartPos.X, HumanoidRootPartPos.Y, HumanoidRootPartPos.Z)

RandomPart.Rotation = NewRotation

You can fix the code to your liking but tell me if this works or not if you ever try it.

oh I didn’t know that you have to seperate the variables I thought it worked like
local orientation = cframe:ToOrientation()
local x,y,z = orientation.X,orientation.Y,orientation.Z
thanks

1 Like

Your solution worked great for me. Thanks. Just a small typo in your variable names. I think you meant to write “ry” and “rz” in the following:
local dx, dy, dz = math.deg(rx), math.deg(ry), math.deg(rz)

2 Likes