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

AStar3D example code for _compute_cost() and _estimate_cost() nonsensical #10230

Open
Nebulous5 opened this issue Nov 8, 2024 · 1 comment · May be fixed by godotengine/godot#98978
Open
Labels
area:class reference Issues and PRs about the class reference, which should be addressed on the Godot engine repository bug content:example code Issues and PRs involving code examples

Comments

@Nebulous5
Copy link

Your Godot version:
4.3 and Latest

Issue description:
The example code in the doc for AStar3D for _compute_cost(u,v) and _estimate_cost(u,v) makes no sense in both GDScript and C#. Unless I'm mistaken, u and v are point ids not point vectors, so these examples compute a value based on subtracting ids which is meaningless.

It should be something more like get_point_position(u).distance_to(get_point_position(v)) for points in euclidean space.

If the intent was really to compute/estimate a cost based on point ids, can someone explain in what situation these examples make any sense?

URL to the documentation page:
https://docs.godotengine.org/en/latest/classes/class_astar3d.html
https://docs.godotengine.org/en/stable/classes/class_astar3d.html

@Nebulous5 Nebulous5 added the bug label Nov 8, 2024
@tetrapod00
Copy link
Contributor

Indeed, these examples don't make much sense. I suppose they could make sense if the "distance" you're measuring is the order that IDs were added?

Something like manhattan distance might be a better example to use.

@tetrapod00 tetrapod00 linked a pull request Nov 8, 2024 that will close this issue
@tetrapod00 tetrapod00 added area:class reference Issues and PRs about the class reference, which should be addressed on the Godot engine repository content:example code Issues and PRs involving code examples labels Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:class reference Issues and PRs about the class reference, which should be addressed on the Godot engine repository bug content:example code Issues and PRs involving code examples
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants