CFrame Angles Always Negative Result

When I use

rowParentBone.CFrame = CFrame.new(rowPosition) * CFrame.Angles(math.rad(90), math.rad(180), math.rad(0))

Why the Orientation becomes -90,-180, 0. I need it to be 90, 180, 0

1 Like

Thats weird, try to use fromEulerAnglesYXZ instead of Angles. Im not sure if this is going work though.

You can also try adjusting it with something like this, again, this might not work:

rowParentBone.CFrame = CFrame.new(rowPosition) * CFrame.Angles(math.rad(-270), math.rad(180), math.rad(0))

I found this funny, local rotation = CFrame.Angles(0, math.rad(180), 0) * CFrame.Angles(math.rad(90), 0, 0) = 90, 180, 0
But the rowParentBone.CFrame = CFrame.new(rowPosition) * CFrame.Angles(math.rad(90), math.rad(180), math.rad(0)) = -90, -180, 0

it is kind of weird though, it shouldn’t be doing that. It might be the order it applies the rotation makes it weird.

Try out:

rowParentBone.CFrame = CFrame.new(rowPosition) * CFrame.fromEulerAnglesYXZ(math.rad(90), math.rad(180), math.rad(0))

Or just use your solution ig:

local rotation = CFrame.Angles(0, math.rad(180), 0) * CFrame.Angles(math.rad(90), 0, 0)
2 Likes

I can confirm @JAcoboiskaka1121 result, it’s due to rotation angle order and also floating point number rounding. Also 180 and -180 in the y axis doesn’t make a difference for this scenario.

local part = script.Parent

part.CFrame =  CFrame.fromOrientation(math.rad(90), math.rad(179.99), math.rad(0)) + part.Position

2 Likes