Skip to content

Commit 40b2d16

Browse files
authored
Proofread the navmesh pathfinding page (#939)
- Match the behavior and property names used in the editor ("Floor/obstacle for pathfinding (navmesh based)", "Max. speed", "Rotation speed"...). - Explain that objects can be walkable floors in 3D, and how the walkable area is defined in 2D. - Mention the "Y speed scale" scene property for isometric games. - Fix the reference page link.
1 parent 565d473 commit 40b2d16

2 files changed

Lines changed: 40 additions & 32 deletions

File tree

docs/gdevelop5/behaviors/nav-mesh-pathfinding/index.md

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ title: Navigation mesh pathfinding
33
---
44
# Navigation mesh pathfinding
55

6-
The **Pathfinding** behavior allows to move objects to a selected destination as well as to flag items as obstacles. Objects that are flagged as obstacles will be avoided by the moving objects.
6+
The **navmesh pathfinding** behaviors move objects to a destination by following walkable floors and going around obstacles. They work in 2D and in 3D, and a whole crowd of characters can move at the same time while avoiding each other.
77

8-
## Choose which objects to avoid
8+
## Choose the floors and the obstacles
99

10-
By using the **Obstacle for Pathfinding (navmesh-based)** [behavior](/gdevelop5/behaviors), you can flag any [object](/gdevelop5/objects) to be an obstacle.
10+
By using the **Floor/obstacle for pathfinding (navmesh based)** [behavior](/gdevelop5/behaviors), you can flag any [object](/gdevelop5/objects) as a walkable floor, as an obstacle, or as both.
11+
12+
In 3D, characters walk on the flat surfaces of these objects and go around the steep ones. Add the behavior to the floors and platforms where characters must walk, and to the walls and props they must avoid.
13+
14+
In 2D, objects with this behavior are always obstacles. Characters can only move inside the rectangle that contains all of them, so put obstacles around the area where characters can go.
1115

1216
When the behavior is added to an object, some properties can be modified:
1317

@@ -16,31 +20,31 @@ When the behavior is added to an object, some properties can be modified:
1620
These properties are only relevant for [3D model](/gdevelop5/objects/3d-model) objects. The 2D collision mask is always used for 2D objects.
1721

1822
* **Shape** – You can choose between using the model shape (**Mesh**) or a bounding box (**Box**).
19-
* **Simplified 3D model** – Models with a lot of polygons can require heavy computations. You can make a simplified version of your model with an external tool and add it in this property to make the obstacle faster to compute.
23+
* **Simplified 3D model** – Models with a lot of polygons can require heavy computations. You can make a simplified version of your model with an external tool and set it in this property to make the obstacle faster to compute.
2024

2125
!!! tip
2226

23-
If you need objects to move in only 4 or 8 direction, you can use the [grid-based pathfinding](/gdevelop5/behaviors/pathfinding) instead.
27+
If you need objects to move in only 4 or 8 directions, you can use the [grid-based pathfinding](/gdevelop5/behaviors/pathfinding) instead.
2428

2529
!!! note
2630

27-
[Tile maps](/gdevelop5/objects/tilemap) can also be used as obstacles: add the **Obstacle for Pathfinding (nav-mesh based)** behavior to a tile map that has collisions, and the moving objects will avoid its tiles.
31+
[Tile maps](/gdevelop5/objects/tilemap) can also be used as obstacles: add the **Floor/obstacle for pathfinding (navmesh based)** behavior to a tile map that has collisions, and the moving objects will avoid its tiles.
2832

2933
## Move objects while avoiding obstacles
3034

31-
The **Pathfinding character (navmesh-based)** behavior allows to compute the shortest path from the object to a destination, and optionally move the object to this destination, while avoiding all objects that have the **Obstacle for Pathfinding (navmesh-based)** behavior.
35+
The **Pathfinding character (navmesh based)** behavior computes the shortest path from the object to a destination and, optionally, moves the object along this path, while avoiding all the objects that have the **Floor/obstacle for pathfinding (navmesh based)** behavior.
3236

3337
After adding the behavior to the object, you can customize some properties:
3438

3539
![](nav-mesh-character-properties.png){ width="387" }
3640

37-
* **Radius** – The half-size of the character. This setting determines how close the object can move to obstacles.
41+
* **Acceleration** – How fast the object accelerates while moving on a path.
42+
* **Max. speed** – The maximum speed the object can reach on the path.
3843
* **Avoidance sight range** – How far ahead the character looks to avoid other characters.
39-
* **Acceleration** – How fast the object is going to accelerate while moving on a path.
40-
* **Max speed** – Maximum speed the object can move on the path.
41-
* **rotate object** – If you don't want the object to rotate while moving on the path, disable the object's rotation.
42-
* **Rotate speed** – The speed of the object's rotation.
43-
* **Angle offset** – In case the sprite is facing the wrong direction, you can fix it with the angle offset
44+
* **Radius** – The radius of the character. This setting determines how close the object can move to obstacles.
45+
* **Angle offset** – In case the sprite is facing the wrong direction, you can fix it with the angle offset.
46+
* **Rotation speed** – The speed of the object's rotation.
47+
* **Rotate object** – Disable it if you don't want the object to rotate while moving on the path.
4448

4549
!!! note
4650

@@ -58,30 +62,34 @@ or in 3D (using the [3d raycast](/gdevelop5/extensions/raycaster3d) extension):
5862

5963
!!! warning
6064

61-
The **Move to a position** action only needs to be run once. If you run this action without any condition, it will try to compute the path at every frame. This will generate a lot of intensive computations for your device. You can add the **Destination reached** condition or use a [timer](/gdevelop5/all-features/timers-and-time) to solve this.
65+
The **Move to a position** action only needs to be run once. If you run this action without any condition, it will compute the path at every frame, which is very demanding for the device. You can add the **Destination reached** condition or use a [timer](/gdevelop5/all-features/timers-and-time) to solve this.
66+
67+
!!! tip
68+
69+
In an isometric 2D game, set the **Y speed scale** scene property to `0.5` so that characters move slower vertically than horizontally.
6270

63-
## Avoid frame skipping when modifying obstacle
71+
## Avoid frame skipping when obstacles change
6472

65-
When obstacles are moved, created, deleted or their behavior is deactivated or activated back, the navigation mesh is updated for the next frame and it can take more than 1/60 second which leads to frame skipping.
73+
When obstacles are moved, created or deleted, or when their behavior is deactivated or activated again, the navigation mesh is rebuilt on the next frame. This can take more than 1/60 of a second, which leads to frame skipping.
6674

6775
You can reduce this side effect by:
6876

6977
- Making **Cell size** and **Cell depth** bigger in the scene properties.
70-
- Setting a **Simplified 3D model** for obstacles that use a **Mesh** shape. The simplified model should have the least amount of polygons possible. For instance, a ramp often only need 5 faces.
71-
- Making a chunk system that destroys obstacles that are faraway by batch.
78+
- Setting a **Simplified 3D model** for obstacles that use a **Mesh** shape. The simplified model should have as few polygons as possible. For instance, a ramp often only needs 5 faces.
79+
- Making a chunk system that destroys far away obstacles in batches.
7280

7381
## Troubleshoot navigation mesh generation
7482

75-
You can display the generated navigation mesh with the **Draw pathfinding walkable area** action.
83+
You can display the generated navigation mesh with the **Draw pathfinding walkable area** action. The walkable area is drawn in blue.
7684

7785
![](nav-mesh-debug.png)
7886

7987
Try to modify the following scene properties and check the effects on the navigation mesh by running a preview:
8088

81-
* **Max. stair height** – If characters won't climb stairs, try with a greater value.
82-
* **Slope max. angle** – If characters won't walk on steep slopes, try with a greater value.
83-
* **Walkable depth** – If characters won't go under a roof, try with a smaller value.
84-
* **Walkable radius** – If characters won't go on a tight way, try with a smaller value. It's usually better to keep it automatic (`-1`) and change the **Radius** on characters.
89+
* **Max. stair height** – If characters won't climb stairs, try a greater value.
90+
* **Slope max. angle** – If characters won't walk on steep slopes, try a greater value.
91+
* **Walkable depth** – If characters won't go under a roof, try a smaller value.
92+
* **Walkable radius** – If characters won't go through a narrow passage, try a smaller value. It's usually better to keep it automatic (`-1`) and change the **Radius** on characters.
8593

8694
![](nav-mesh-scene-properties.png){ width="382" }
8795

@@ -100,4 +108,4 @@ Try to modify the following scene properties and check the effects on the naviga
100108

101109
## Reference
102110

103-
All actions, conditions and expressions are listed in [the nav-mesh pathfinding reference page](/gdevelop5/all-features/nav-mesh-pathfinding-behavior/reference/).
111+
All actions, conditions and expressions are listed in [the navmesh pathfinding reference page](/gdevelop5/all-features/nav-mesh-pathfinding/reference/).

docs/gdevelop5/behaviors/pathfinding/index.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ title: Grid-based pathfinding
33
---
44
# Grid-based pathfinding
55

6-
The **Pathfinding** behavior allows to move objects to a selected destination as well as to flag items as obstacles. Objects that are flagged as obstacles will be avoided by the moving objects.
6+
The **grid-based pathfinding** behaviors move objects to a selected destination and flag items as obstacles. Objects that are flagged as obstacles will be avoided by the moving objects.
77

8-
## Choose which objects to avoid: the "Obstacle for Pathfinding" behavior
8+
## Choose which objects to avoid
99

10-
By using the **Obstacle for Pathfinding (grid-based)** [behavior](/gdevelop5/behaviors), you can flag any [object](/gdevelop5/objects) to be an obstacle.
10+
By using the **Obstacle for pathfinding (grid-based)** [behavior](/gdevelop5/behaviors), you can flag any [object](/gdevelop5/objects) to be an obstacle.
1111

1212
When the behavior is added to an object, some properties can be modified:
1313

@@ -18,15 +18,15 @@ When the behavior is added to an object, some properties can be modified:
1818

1919
!!! tip
2020

21-
Obstacles may take more space than expected because a box around obstacles is used instead of the [collision mask](/gdevelop5/objects/sprite/collision-mask). The [navigation mesh pathfinding](/gdevelop5/behaviors/nav-mesh-pathfinding) can be used instead to solve this.
21+
Obstacles may take more space than expected because a box around obstacles is used instead of the [collision mask](/gdevelop5/objects/sprite/collision-mask). You can use the [navigation mesh pathfinding](/gdevelop5/behaviors/nav-mesh-pathfinding) instead to solve this.
2222

2323
!!! note
2424

25-
[Tile maps](/gdevelop5/objects/tilemap) can also be used as obstacles: add the **Obstacle for Pathfinding (grid-based)** behavior to a tile map that has collisions, and the moving objects will avoid its tiles.
25+
[Tile maps](/gdevelop5/objects/tilemap) can also be used as obstacles: add the **Obstacle for pathfinding (grid-based)** behavior to a tile map that has collisions, and the moving objects will avoid its tiles.
2626

2727
## Move objects while avoiding obstacles
2828

29-
The **Pathfinding character (grid-based)** behavior allows to compute the shortest path from the object to a destination, and optionally move the object to this destination, while avoiding all objects that have the **Obstacle for Pathfinding (grid-based)** behavior.
29+
The **Pathfinding character (grid-based)** behavior computes the shortest path from the object to a destination and, optionally, moves the object along this path, while avoiding all the objects that have the **Obstacle for pathfinding (grid-based)** behavior.
3030

3131
After adding the behavior to the object, you can customize some properties:
3232

@@ -45,7 +45,7 @@ After adding the behavior to the object, you can customize some properties:
4545

4646
!!! note
4747

48-
A smaller cell size implies more computations so try to still keep the size as large as possible.
48+
A smaller cell size implies more computations, so try to keep the size as large as possible.
4949

5050
To initiate a pathfinding move, add the action **Move to a position** and specify the location you want the object to move to.
5151
It will move using the characteristics defined in the behavior properties.
@@ -55,7 +55,7 @@ If you want to change how the object moves during the game, these properties can
5555

5656
!!! warning
5757

58-
The **Move to a position** action only needs to be run once. If you run this action without any condition, it will try to compute the path at every frame. This will generate a lot of intensive computations for your device. You can add the **Destination reached** condition or use a [timer](/gdevelop5/all-features/timers-and-time) to solve this.
58+
The **Move to a position** action only needs to be run once. If you run this action without any condition, it will compute the path at every frame, which is very demanding for the device. You can add the **Destination reached** condition or use a [timer](/gdevelop5/all-features/timers-and-time) to solve this.
5959

6060
## Examples
6161

0 commit comments

Comments
 (0)