Whenever I add rotation onto parts CFrame using:
workspace.Part.CFrame = workspace.Part.CFrame * CFrame.Angles(0,math.rad(90),0)
it only rotates the part locally, which is fine, but whenever the part is already rotated in a random direction, it rotates the part in an unwanted way. How would I change this to make the part rotate globally instead of locally?
2 Likes
PapaBreadd
(PapaBreadd)
August 29, 2021, 8:19pm
#2
CFrame.new(part.Position)*CFrame.Angles(x,y,z)
Should do the trick
It’ll make an unrotated CFrame using only the position then rotate it from there
Should’ve clarified, that I want the rotation to be added onto the current rotation, and not to be replaced completely.
primo222
(BigGooss)
August 30, 2021, 12:44pm
#4
workspace.Part.CFrame = CFrame.new(workspace.Part.Position)*CFrame.Angles(math.rad(workspace.Part.Orientation.X + 15),0,0)
Arent post above solves issue? I guess it is if you got it right
UPD: Sent a wrong script, because of miscunderstanding
PapaBreadd
(PapaBreadd)
August 30, 2021, 12:57pm
#5
CFrame.Angles(x,y,z)*(cframe-cframe.p)+cframe.p
That should create a CFrame exactly like the current one but rotated in place relative to world rotation
If you mean pivoting it relative to the world origin this should work:
CFrame.Angles(x,y,z)*cframe
3 Likes