Download

Inverse Vector Line

Good evening,

Wanted to share a current issue im having, hoping for someone to know how to fix it :slight_smile:

image
Lets say we have this coordinate plane.

My game is topdown view. Supossing the character is the red dot, I would like to inverse completely the movement of the player. Example, if I click Coord (X=1, Y=1), I would like the end result to be Coord: (X=-1, Y=-1) so basically the inverse of square 1 is 3… The inverse of 4 is 2 and so on.

image
By using this I can solve it, but just on the “coordinate plane” meaning this is not passed on to the World Coordinates, which is why I need.

if my player is in coordinate 0,0,0 and I click 100,150,0 I want the final coordinate to be -100,-150,0

Hope it makes sense. Basically inverse the world coordinate, based on the cartesian system.
So I would need to somehow convert my cartesyan coordinate to the world coordinate, which I cant find a way, unless there is an easier way (using trace?)

Can you do PlayerVector - ClickVector?

This will get the vector from your player to the ClickVector.

Also, (0, 0, 0) - (100, 150, 0) = (-100, -150, 0)

Heya,

sadly that wouldnt work.

To make it more simply, the distance from my player to the click, I need that same distance but inverse. The issue is not obtaining the distance, but reversing that (getting the inversed coordinates) since the player will most likely not be on a 0,0 vector

Negate Vector? To clarify:

Negate the direction and add it to the player location or reverse the order of Get Unit Direction node. The above gives you this:

We’re getting close or am I confusing things?

1 Like

That is just perfect.


The red lines are the click.
I just added another trace on the end of the inverse to grab the floor coordinates. Just what I needed - spent the whole day trying and researching.

Thank you very much!

1 Like

just multiply everything with -1… youre welcome :stuck_out_tongue: