So, I’m constructing a functional mirror in my game. I’ve almost got it working. One problem:
The limbs appear in the correct position, however, the parts in the reflection model retain the same CFrame as the parts in the player model.
How would I fix this? I am not very good at working with CFrame.
Here is my current code.
local mirror = workspace.MirrorA
local reflection = workspace.PlayerReflectionA
--Mirror reflection
while true do
wait()
local mirrorCFrame = mirror.CFrame
for _, reflPart in pairs(reflection:GetChildren()) do
local charPart = char:FindFirstChild(reflPart.Name)
if charPart then
local charPartMirrorDifferential = Vector3.new(-(charPart.CFrame.X - mirrorCFrame.X), charPart.CFrame.Y - mirrorCFrame.Y, charPart.CFrame.Z - mirrorCFrame.Z)
local reflCFrame = mirrorCFrame + charPartMirrorDifferential
local charCFrame = charPart.CFrame
reflPart.CFrame = CFrame.new(reflCFrame.X, reflCFrame.Y, reflCFrame.Z) * CFrame.Angles(charPart.CFrame:toEulerAnglesXYZ())
end
end
end