Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Mirroring a CFrame? [Deprecated]

Asked by 10 years ago

How would I go about mirroring a CFrame? I tried multiplying the Rotation vectors by math.rad(180) - individually by code, and simultaneously.

It was close but still obviously inaccurate. The part is merely rotated on the Y axis, and the mirror part was slightly etched on all three axis. It was close, though.

Does CFrame:inverse() do this? If not, is there a method/equation that does?

Thanks for reading.

Edit: I didn't want to mirror the CFrame, I wanted to mimic the rotation from a second person perspective - 180 degrees flip.

2 answers

Log in to vote
0
Answered by 10 years ago

Here's what I understand:

CFrame: 1,1,1 What you want: -1,-1,-1 Right?

If so, All you need to do is Multiply the current CFrame by -1 (-1*1 = -1)

0
I figured it out on my own. I know how to use CFrame multiplication - all I had to do was reinstate the rotation. Drak0Master 172 — 10y
0
Alright, but that's the method I would do if you were to swap the Vector3 from positive to negative. fahmisack123 385 — 10y
Ad
Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

This question has been asked

This function mirrors a CFrame about one of the origin's planes:

function mirrorCFrame(cf)
    local mi = Vector3.new(-1,1,1);
    local np = cf.p * mi;
    local mi = CFrame.new( np , np + cf.lookVector * mi * -1 );
    local up = CFrame.new(cf.p,cf.p + cf.lookVector);
    local from = up:toObjectSpace(cf);
    return mi:toWorldSpace(from) * CFrame.Angles(0,math.pi,0);
end

Answer this question