Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability for the navigation agent to set the desired distance to the target (not to the next waypoint) #3813

Closed
Killfrra opened this issue Jan 17, 2022 · 1 comment
Milestone

Comments

@Killfrra
Copy link

Describe the project you are working on

Simple League-of-Legends alike MOBA

Describe the problem or limitation you are having in your project

I would like the player to be able to zoom in a set distance to a point outside of the navigation mesh. The problem is that even if the navmesh is generated in such a way that the distances from its edges to the tower are the same (literally, with an accuracy of 0.000001), when building the path, one point is still selected, to which the agent moves:

simplescreenrecorder-2022-01-17_04.24.45.mp4

The green dot is the target. Blue is the point chosen by the end agent. Green zone - desired radius (doesn't play a role)

Describe the feature / enhancement and how it helps to overcome the problem or limitation

See below.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Rename the target_desired_distance navigation field of NavigationAgent to waypoint_radius to avoid misconceptions like godotengine/godot#56813 in the future. Introduce the desired_target_distance field (by default equal to zero) as the distance to the target (which is set by the set_target_location), so that the agent aim for any nearest point in this radius. Or let the user pass an array of points to the agent so that he chooses the closest one of his own, for example, by introducing the set_target_locations function (which is likely to be the most generic solution). Or introduce an enum that will allow to choose what to do if the point is outside the navmesh: look for the nearest edge to it or go to the nearest edge that encircles this point.

If this enhancement will not be used often, can it be worked around with a few lines of script?

I tried - I didn't succeed. Probably a few lines are not enough.

Is there a reason why this should be core and not an add-on in the asset library?

While trying to solve a seemingly simple problem

(again)the character needs to approach the building no matter from which side, but at the same time everyone else should avoid it if they do not need it
I felt like I was thinking about how I could write my own navigation, but I didn't want to spend time on it and didn't want anyone to have to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants