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
awry_y
(Harper_Clark)
June 6, 2024, 10:24am
#3
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
awry_y
(Harper_Clark)
June 6, 2024, 12:15pm
#5
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
To rotate by world axis without any local effects, but whilst maintaining the position of the part, you’ll need to extract the Euler angles and simply add the world rotation onto it, then reconstruct a rotational CFrame from those Euler angles, and finally add the position back into it. I use Rx, Ry and Rz to represent the angle you want to turn it through in world space.
local rx, ry, rz = Part.CFrame:ToEulerAnglesYXZ()
Part.CFrame = CFrame:FromEulerAnglesYXZ( rx + Rx, ry + Ry, rz + Rz ) + Par…
1 Like
awry_y
(Harper_Clark)
June 6, 2024, 12:29pm
#8
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
system
(system)
Closed
June 21, 2024, 12:34am
#13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.