Cframes being silly

Today I needed to make a part rotate by 90 degrees, so heres the math:

local rotated = CFrame.Angles(0,math.rad((90)),0) * H.CFrame

rotated is what I am going to rotate it to, only problem is that it goes like to a whole other position instead of just rotating, and even though this is so simple I have no idea why.

When I actually rotate it this is what I do:

	local rotated = CFrame.Angles(0,math.rad((90)),0) * H.CFrame -- cframe
	local rotatedBack = H.CFrame
	
	print(rotated)
	print(rotatedBack)
	
	there[H.Name] = tweenService:Create(H,doorOpenInfo,{CFrame = rotated}) -- rotate it

From printing rotated and rotatedBack (the og cframe) the position part is changed so idk whats going on.

CFrame multiplication is not commutative, which means H.CFrame is being applied relative to the rotation. Try reversing the order like so:

local rotated = H.CFrame * CFrame.Angles(0, math.rad(90), 0)
4 Likes

Its always something so simple lol, thanks!