Rotating X while Y rotaion is at 90 it changes Z instead

what the title says and i have no clue how to fix this


i have it selected so u can see how its rotations changes in properties

Build:PivotTo(CFrame.new(mouse.Origin * CFrame.new(0,0,-7).Position)*CFrame.Angles(math.rad(rX),math.rad(rY),math.rad(rZ)))
1 Like

For this you need to do:

CFrame.Angles(0,math.rad(rY),0) * CFrame.Angles(math.rad(rX),0,math.rad(rZ))

(I accidently posted the above reply.)

1 Like

this didnt change much


also it looks like x and z are swaped but they arent

1 Like

Try multiplying the values with the tables CFrame, so:

Build:PivotTo(Build:GetPivot() * CFrame.Angles(0,math.rad(delta_rY),0)*CFrame.Angles(math.rad(delta_rX),0,math.rad(delta_rZ)))
1 Like

didnt change anything its the same as this video above

1 Like

Try using the rotation in world space formula

1 Like

Hm… I think I know the issue now…

Build:PivotTo(CFrame.new(mouse.Origin * CFrame.new(0,0,-7).Position)*CFrame.Angles(math.rad(rX),0,math.rad(rZ))*CFrame.Angles(0,math.rad(rY),0))
1 Like

so only problem is that when Y is 90 or -90 rotating by X axis rotates Z instead

local rx, ry, rz = Build.PrimaryPart.CFrame:ToEulerAnglesYXZ()
Build:PivotTo(CFrame.fromEulerAnglesXYZ(rx + math.rad(rX),ry + math.rad(rY),rz + math.rad(rZ)) + Build.PrimaryPart.CFrame.Position)

edit:
also rotating Y when its at 90 or -90 rotates X

1 Like

Why are you using YXZ orientation.

And then XYZ?

1 Like

fixed it and same thing still happening
so when y is 90 or -90 x rotates z and z rotates x

1 Like

ty for the help but i have solved it, so when u rotate it will just add that angle to the cframe

if input.KeyCode == Enum.KeyCode.R then
	if  RotateDir == "X" then
		Build:PivotTo(Build.PrimaryPart.CFrame * CFrame.Angles(math.rad(90),0,0))
	end
	if  RotateDir == "Y" then
		Build:PivotTo(Build.PrimaryPart.CFrame * CFrame.Angles(0,math.rad(90),0))
	end
	if  RotateDir == "Z" then
		Build:PivotTo(Build.PrimaryPart.CFrame * CFrame.Angles(0,0,math.rad(90)))
	end
end
Build:MoveTo(CFrame.new(mouse.Origin * CFrame.new(0,0,-7).Position).Position)
RotateView:PivotTo(Build.PrimaryPart.CFrame) --the rotation circles u see

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