Quoting an old question by lightpower25 which was never answered:
"
If you've used ROBLOX's animation plugin you should know what I mean. If not, then take a look at this. See how it rotated differently than if I tried to rotate it relative to the part? It's even more explained by this. See how it moves relative to the part on local space, and relative to the world in global space? That's what I mean. I thought for sure I figured out how to move objects globally, but I was dead wrong. It was the same concept as the local movement. So now I'm stuck with having no idea as of what to do to move parts in a global space. I have the same problem with rotating. Any answer/comment will be appreciated!
--This is how I rotate parts: workspace.Part.CFrame = workspace.Part.CFrame * CFrame.Angles(math.rad(45), 0, 0) --That moves it 45 degrees on the X Axis. --To move parts: workspace.Part.CFrame = workspace.Part.CFrame * CFrame.new(5, 0, 0) --That moves it 5 studs on the X Axis
Also, note I'm actually trying this with welds, so it may react differently then I actually expect it to
"
I'm really struggling on making a part rotate around the global X, Y, Z axises, after a rotation, subsequent rotations will always occur relative to the part's new position, no matter what method I use. Any ideas?
I suppose the easiest world axis rotation is instead of CFrame * rotation
, do rotation * CFrame
. It's that simple except to preserve position you'll have to add it back later.
local rot = CFrame.Angles(math.pi/4,0,0) Part.CFrame=(rot*(Part.CFrame-Part.CFrame.p))+Part.CFrame.p