Hello.
Since no one has unsubscribed, it means it’s not easy. I’ve already done about this. It was necessary to stop the warrior within striking distance.
Here is the algorithm.
- First you check the availability of the path to the port.
- If the path is not available, find the end point of the path. This is the point where your ship is currently in the picture.
- Find the previous point. But it’s not perfect. It may be necessary to find the point following it, but I did not do this.
- Look for the direction vector. From the end point of the path to the previous point.
- This vector is multiplied by the distance you need. You add the resulting vector to the end point of the path. This is a new point and there is what you need.
Here is my example.
https://forum.arongranberg.com/t/how-to-go-to-the-neighboring-node-is-there-an-easy-way-to-colorize-a-line-renderer/12743