godotengine / godot-docs

Godot Engine official documentation
https://docs.godotengine.org
Other
3.91k stars 3.2k forks source link

Documentation for AStarGrid2D set_point_solid() is misleading, especially regarding "no need to call update()" #8893

Open Zyjinn opened 8 months ago

Zyjinn commented 8 months ago

Your Godot version: 4.2

Issue description: While working with AStarGrid2D I noticed two issues with the documentation on the "AStarGrid2D" node:

  1. The "Set_Point_Solid()" call documentation has a note at the end that says "update() is not needed after the call of this function":

Disables or enables the specified point for pathfinding. Useful for making an obstacle. By default, all points are enabled.

Note: Calling update is not needed after the call of this function.

However, the "update()" call notes this:

Note: All point data (solidity and weight scale) will be cleared.

So, if you call update(), not only is it not needed, but it will clear all points set to solid.

  1. More minor, but the wording around set_point_solid() is a bit confusing, as it mentions that "by default, all points are enabled", which combined with the 2nd parameter in "set_point_solid()" it kind of leads users to believe that the default state of navigation tiles is "solid = true", thus, to set a point solid, it should be set to "false".

Let me know if there's any further questions, but I just had a bunch of issues with this on the Godot forums here debugging an issue, and both of us were confused debugging this, so wanted to fix this up!

tl;dr, my recommendations are:

  1. Change the "Calling update is not needed after the call of this function" to "Calling update after this function will reset all points to solid = false"
  2. Change the set_point_solid() documentation from: Disables or enables the specified point for pathfinding. Useful for making an obstacle. By default, all points are enabled. to: Disables or enables the specified point for pathfinding. Useful for making an obstacle. By default, all points are set to solid = true".

Suggestions or specifics can be adjusted of course, I just wanted to note this potential issue!

Thanks,

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

Zyjinn commented 8 months ago

Apologizes, I fat fingered my enter key, let me edit this...

Edit: Should be fixed!

Efimero commented 8 months ago

I believe the correct sentence is "By default, all points are set to solid = false", since by default all are walkable.

Zyjinn commented 8 months ago

I believe the correct sentence is "By default, all points are set to solid = false", since by default all are walkable.

Haha, correct, re-reading my wording I think it is confusing in a similar way to the original the way I worded it.

Thanks for catching that!