Yes, I know it’s my 4th topic about CFrames in less than one week. I’m sorry but I’m still confused about world space and object space!
So, here’s exactly what I’m trying to ahieve:
There are 2 parts of identical size but different position: Part0 and Part1. You know the keybind ctrl+L that allows you to switch from world space to local space, right? The Part1 must rotate itself on its local axis after the Part0’s local axis.
Since it’s, extremely hard to explain, I’ll give an example:
If the Part0 is rotated 90 degrees on its local X axis, the Part1 should automatically rotate on it’s own local axis by 90 degrees.
My current script doesn’t exactly works like explained above, because I’m not very familiar with world space/local space and I don’t really know what’s missing.
local originalCF = p0.CFrame --The Part0's original CFrame.
local function onOrientationChanged()
local newCF = part0.CFrame --Save the new Part0's CFrame.
local Angles = (newCF - newCF.p) * (originalCF - originalCF.p):Inverse() --newCF / originalCF
part1.CFrame = part1.CFrame * Angles
originalCF = newCF --Apply the new Part0's CFrame.
I’ll try to make a video if what I wrote is too hard to understand