What's The Most Efficient Way To Get The Orientation Of A Part's CFrame And Modify It?

So, I’m Working On A Platformer…Inside A Plugin, It’s A Ridiculous But Fun Idea, I’m At The Point Where I Have To Face The Ultimate Question, How Do I Get The Orientation Of A Part’s CFrame, I Know There’s Many Ways (Or, At Least I Think So) But A Need A Efficient And Dependable Method Of Doing So? Please Give Me Some Pointers In The Comments, Thanks.

1 Like

Here are some different ways to get the orientation from a CFrame. It’s important to note that the value returned by :ToOrientation() is in radians, that’s why I included the custom function.

local part : BasePart

local x, y, z = part.CFrame:ToOrientation()
local orientation = Vector3.new(part.CFrame:ToOrientation())
------------------------------------------------------------
local function getCFrameOrientation(cframe : CFrame) : Vector3
	local x, y, z = part.CFrame:ToOrientation()
	local deg = math.deg
	return Vector3.new(deg(x), deg(y), deg(z))
end
local orientation = getCFrameOrientation(part.CFrame)
2 Likes

Thanks For The Reply, These Help Alot!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.