I need to add two CFrame angles together, but when I do, It does not do what I expect.
local StartingAngle = CFrame.Angles(math.rad(73),0,math.rad(116))
local AddAngle = CFrame.Angles(math.rad(-13),0,math.rad(4))
local ResultantAngle = StartingAngle:ToWorldSpace(AddAngle)
local A = Vector3.new(StartingAngle:ToEulerAnglesYXZ())
print(math.round(math.deg(A.X)),math.round(math.deg(A.Y)),math.round(math.deg(A.Z)))
local A = Vector3.new(AddAngle:ToEulerAnglesYXZ())
print(math.round(math.deg(A.X)),math.round(math.deg(A.Y)),math.round(math.deg(A.Z)))
local A = Vector3.new(ResultantAngle:ToEulerAnglesYXZ())
print(math.round(math.deg(A.X)),math.round(math.deg(A.Y)),math.round(math.deg(A.Z)))
Why is it doing this? And how can I do this properly in the way I want?
local StartingAngle = CFrame.Angles(math.rad(73),0,math.rad(116))
local AddAngle = CFrame.Angles(math.rad(-13),0,math.rad(4))
local ResultantAngle = StartingAngle * AddAngle
This is the way you should add cframes to each other
That gives 60 8 124 for some reason, closer but not exactly.
Should I just extract the angles with :ToEulerAnglesYXZ() and then add them together that way? That seems so wrong.
local StartingAngle = CFrame.Angles(math.rad(73),0,math.rad(116))
local AddAngle = CFrame.Angles(math.rad(-13),0,math.rad(4))
local TrueVector = Vector3.new(StartingAngle:ToEulerAnglesYXZ())+Vector3.new(AddAngle:ToEulerAnglesYXZ())
local ResultantAngle = CFrame.Angles(TrueVector.X,TrueVector.Y,TrueVector.Z)
--Expected (60,0,120)
local A = Vector3.new(StartingAngle:ToEulerAnglesYXZ())
print(A.X,A.Y,A.Z)
local A = Vector3.new(AddAngle:ToEulerAnglesYXZ())
print(A.X,A.Y,A.Z)
local A = Vector3.new(ResultantAngle:ToEulerAnglesYXZ())
print(A.X,A.Y,A.Z)