Download

Distance measurement with blueprint

Hello everybody,

I’m in need of some help with a serious issue to finish my project finally.
Basicly the process I want to set up is the player drawing a line and the system should give me the length of the line or lets say the distance between the 2 points between the line is drawn. Now first of all, forget about the line, I’m not sure how to set this up properly anyways. More important: right now: if I try to get the length of a cube, my result is different when I’m 2 meters away of it or when I’m standing right infront of it.

I obviously am not putting in the right coordinates but also don’nt know how to fix that. Can someone please help? This my current blueprint.

The variables might be german some times, its basicly just checking if the measurement-function is active or not in the branches.
I hope you get what im trying to achieve and what my problem is.

tl;dr: want to get the distance between 2 points, right now its not working because the result of the same distance is different when im further away of the target location im trying to get the distance from

This is the correct set up for getting the distance between two 2D points:

2547b328a9a081b2b6e19e705314194bd395c240.jpeg

Oh thank you so much, i will try that tomorrow morning :slight_smile:

Hmm :frowning: unfortunately its not fixed yet :confused: please heeeelp :smiley:

8811b306e81f8227283dfa6c6f8ac47b9a35673f.jpeg

I think part of your problem is that the node “get Mouse Position” returns the position of the mouse on the screen in an X,Y format. It does not return the location in 3D space. So your result is going to change depending on where you click as well as the size of the viewport you are currently using to view the game. To see what I mean, try using a “print to screen” node to print the output of that “get Mouse Position” node.

Yes by now i understand the issue, but I cant think of a way to work around that. Does someone know? It would be really important :confused: