I have a pretty bad understanding of CFrames and terminology, so bear with me.
The white part is the center cframe,
The red part is where the current cframe is,
The green part is the cframe I want to get to (it’s like the opposite of the red part)
-- some CFrames
local WhitePart = CFrame.new()
local RedPart = CFrame.new()
-- RedPart:ToObjectSpace(WhitePart) is the same as RedPart * WhitePart:Inverse()
local GreenPart = WhitePart * RedPart:ToObjectSpace(WhitePart):Inverse()
-- some CFrames
local WhitePart = CFrame.new()
local RedPart = CFrame.new()
-- RedPart:ToObjectSpace(WhitePart) is the same as RedPart * WhitePart:Inverse()
-- this comment above has an error in it
local GreenPart = WhitePart * RedPart:ToObjectSpace(WhitePart)
RedPart:ToObjectSpace(WhitePart) is the same as RedPart:Inverse() * WhitePart
not
RedPart:ToObjectSpace(WhitePart) is the same as RedPart * WhitePart:Inverse()
do you want to just get the position or exactly CFrame? because it kinda goes off using just CFrames
code below uses positions
local WhitePart = Vector3.new()
local RedPArt = Vector3.new()
local GreenPart = WhitePart - (RedPart - WhitePart)
-- which simplifies to
local GreenPart = 2*WhitePart - RedPart
ok so you want to reflect RedPart along WhitePart taking in count only the rotation of white part?
screenshots above take in count rotation of both parts
I got it to work, it feels a little bit hacky but I can always look for a better solution later. Thank you @V_ladzec for helping!
Here’s my code:
local relative = redCframe:ToObjectSpace(centerCframe):Inverse()
local rotx, roty, rotz = relative:ToOrientation()
relative = CFrame.new(
-relative.Position,
Vector3.new(math.deg(rotx), math.deg(roty), math.deg(rotz)) -- You can make this negative if you want to flip rotation too, but in my case I dont want to
)
local flippedCFrame = centerCframe * relative