How to get opposite point relative to corner?

Cant really explain that well, so heres an ms paint drawing

The Red dot is what the raycast has hit, then using the red dots position it finds the closest corner to the red dot from the Instance that the raycast hit.

The corner is now the origin, how would I get the green dot? (which is just a flipped red dot on the other side of the corner)

I’m basically trying to get the other side of the corner aka if the raycast weren’t to stop then the green dot is where the raycast would have exited the part (Assuming raycast is perfectly straight so the distance to the origin would be the same for both points).

Heres a top down view of the picture:

What I’ve tried:
I’ve tried multiplying the direction by -1, however what that gets me is:
image

I’ve also asked ChatGpt which gave me this:

When implementing it, it gave me:
image
Which is the same as multiplying direction by -1

I have no clue on how I would get the green dot, am I just complicating it?

Let me get some clarification; In this picture, would #1 be correct for where the raycast hit (red) and the goal vector ends up (green), or would #2 be correct?

info

Also, are we dealing with non-rotated parts, or can parts be rotated?

If the distances from each point to the origin are the same than that would be correct, but in #1 the red point is closer to the left side of the corner so that would be the origin, also the parts can be rotated.

2 Likes