Getting the opposite vector3 from a central point

Hello, I am trying to make a rope swing system.

I need to get a vector3 position “opposite” an original position to get the end point of each swing.

The system consists of the hook point and the player, what I want is for a new vector to be created at a position on the opposite side of the hook as if the player location is being mirrored.

Here is an diagram of what, I mean though the “Reversed position” should be labeled mirrored or opposite.

Any help would be greatly appreciated.

Thanks.

If you define Original Position as P1, Central Point as P2 and Reversed Position as P3…

V21 is the vector from P2 to P1, defined as (P1 - P2).

So, how do you get the second vector.

You can do it rather easily if you “Rotate V21 180 degrees around the world Y axis”.

This rotation can be achieved like this: Quaternion.AngleAxis(180, Vector3.up).

So, the vector you want, V23, is Quaternion.AngleAxis(180, Vector3.up) * V21.

Now, P3 = P2 + V23.

That’s the math.

The code is…

P3 = P2 + (Quaternion.AngleAxis(180, Vector3.up) * (P1 - P2));

Hope this helps.