I’m having trouble to detect the distance between the player and an object, trying to use a path created by the object to the player.
Like, I’m trying to get the distance of an object to the player when he is on the side of a wall. The ideia was to calculate the path that creates, the green line distance.
But not adding an AI class to the item, I’m afraid that the game get lagged because of the quantity of items calculating this. Maybe a simple class to only calculate that path.
I tried a lot of things, trying to get the distance of the player, but couldn’t define the distance between the player and the object, only the target where it was clicked, and most of the time, I got the distance in a line, going through the wall.
Is there a way to get this distance?