im using a console script I wrote to mirror an interstate ramp across a road. This is the code I am using:
local center = Vector3.new(2445.805, 2.7, -1954.752)
local newRamp = Instance.new("Model")
newRamp.Name = "NewRamp"
newRamp.Parent = workspace
local posMirror = Vector3.new(1,1,-1)
local rotMirror = Vector3.new(-1,-1,1)
for _,step in workspace.Ramp:GetChildren() do
if not step:IsA("Model") then continue end
local new = step:Clone()
offsetFromCenter = step:GetPivot().Position-center
local newP = center+posMirror*offsetFromCenter
local oldAngle = Vector3.new(step:GetPivot():ToOrientation())
local mirroredAngle = oldAngle*rotMirror
new:PivotTo(CFrame.new(newP)*CFrame.Angles(mirroredAngle.X,mirroredAngle.Y,mirroredAngle.Z))
new.Parent = newRamp
end
Center V3 is where I have circled on the diagram. It works successfully and generates a new ramp mirrored from the old ramp, however there are minor inaccuracies with the rotation (see below) on the new ramp, which do no exist on the old ramp. Im wondering where I went wrong in my math
Ramp im mirroring (if you wanna try)
Ramp.rbxm (9.3 KB)
Any help or ideas appreciated