Possible to turn Vector3 into CFrame.Angles?

Greetings!
So I stumped into a problem where I couldn’t use TweenService with Orientation, that’s not our problem. But my question is it possible to turn Vector3 into CFrame.Angles? For example, I have a vector of orientation and I want to “turn” that vector into CFrame.Angles, appreciated!

Try:

local v = Vector3.new(90, 90, 90) -- just an example
local cf = (
    part.CFrame *
    CFrame.Angles(
        math.rad(v.X),
        math.rad(v.Y),
        math.rad(v.Z)
    )
)

So what this does is first gets the existing CFrame of the part, and orients it according to your Vector3 value.

4 Likes

Oof, I forgot to put math.rad :wink:
Thanks for the response!

1 Like

Just a heads up, CFrame.Angles is not equal to orientation the order the angles get applied in is different and may lead to odd movement.

Personally, I recommend using CFrame.fromOrientation() as you can work with orientation terms as well in the x, y axis rotation of movement. But yeah remember to math.rad it like @0V_ex has done.

5 Likes