The following functions are very much confusing me, in my head I understand I want to convert a position in world space ( for example a position that may be 10 studs away from the user on the X, but 100 studs from the origin ) to object space, but I’m beyond confused, using PointToObjectSpace (as I imagine I would since I’m converting World to Object, right? gives me more arbitrary results which aren’t correct.
Update, I was using VectorToObjectSpace instead of PointToObjectSpace, so I’ve actually got it working now, but on another note, could anyone give me a quick rundown on the use case scenarios on these functions?
I think I somewhat understand VectorToObjectSpace now that I’ve seen what PointToObjectSpace does (and their partners ToWorldSpace).
But the core :ToObjectSpace and :ToWorldSpace seem to still confuse me so any clear ups on that would be awesome.
Basically, ToObjectSpace is like subtraction.
So CFrameA:ToObjectSpace(CFrameB) will give you the offset of CFrame B from CFrame A, similar to how 2 is the difference of 10 - 8 (8 is offsetted by 2 from 10, ignore the direction). This also means that if you were to add the result of CFrameA:ToObjectSpace(CFrameB) to CFrame A, it will give you CFrame B.
Meanwhile, ToWorldSpace is more like addition. CFrameA:ToWorldSpace(CFrameB) will add CFrame B to CFrame A, similar to how 10 is the sum of 8 + 2 (8 offsetted by 2 is 10). In other words, if you were to subtract CFrame B from CFrameA:ToWorldSpace(CFrameB), it will give you the original CFrame A without the offset of CFrame B.