Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/gdevelop5/all-features/admob/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ See how the ads work in a game by opening the example called **AdMob**. Replace

!!! tip

Try it online! Click **[here to open the Admob example](https://editor.gdevelop.io/?project=example://admob)**. You must export to Android using the desktop app to test it on a real phone.
Try it online! Click **[here to open the Admob example](https://editor.gdevelop.io/?create-from-example=admob)**. You must export to Android using the desktop app to test it on a real phone.

## Reference

Expand Down
2 changes: 1 addition & 1 deletion docs/gdevelop5/all-features/dialogue-tree/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ The demo does not use the entire capability of the extension and is aiming to pr

# Examples

[Open example in GDevelop](https://editor.gdevelop.io/?project=example://dialogue-tree-with-yarn){ .md-button .md-button--primary }
[Open example in GDevelop](https://editor.gdevelop.io/?create-from-example=dialogue-tree-with-yarn){ .md-button .md-button--primary }

## Reference

Expand Down
2 changes: 1 addition & 1 deletion docs/gdevelop5/all-features/firebase/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This is all you need for a basic profile most of the time.
To store more data, you will need to use something like [Firestore](/gdevelop5/all-features/firebase/firestore).
!!! tip

To use the photo URL, take a look at the example that [loads an image from a URL to a sprite](https://editor.gdevelop.io/?project=example://load-image-from-url).
To use the photo URL, take a look at the example that [loads an image from a URL to a sprite](https://editor.gdevelop.io/?create-from-example=load-image-from-url).

## Provider setup

Expand Down
2 changes: 1 addition & 1 deletion docs/gdevelop5/all-features/firebase/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ Currently, there is not much that you can do with storage.
You can get the download URL of an online file and let the user download it, which can be useful for example for hosting and downloading updates.
!!! tip

You can also combine it with [the load image from url](https://editor.gdevelop.io/?project=example://load-image-from-url) example.
You can also combine it with [the load image from url](https://editor.gdevelop.io/?create-from-example=load-image-from-url) example.
12 changes: 6 additions & 6 deletions docs/gdevelop5/all-features/gamepad/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,25 @@ The "Platformer gamepad mapper" behavior can be added to the character to make t
Learn more about the [Platform Character behavior](/gdevelop5/behaviors/platformer).


[Open example in GDevelop](https://editor.gdevelop.io/?project=example://platformer){ .md-button .md-button--primary }
[Open example in GDevelop](https://editor.gdevelop.io/?create-from-example=platformer){ .md-button .md-button--primary }

[![](/gdevelop5/behaviors/platformer/platformer-example.png){ width="320" }](https://editor.gdevelop.io/?project=example://platformer)
[![](/gdevelop5/behaviors/platformer/platformer-example.png){ width="320" }](https://editor.gdevelop.io/?create-from-example=platformer)

### Move a 3D platformer character

The "3D platformer gamepad mapper" behavior can be added to a [3d physics character](/gdevelop5/behaviors/physics3d) to make the character move according to player inputs automatically.

[Open example in GDevelop](https://editor.gdevelop.io/?project=example://3d-platformer){ .md-button .md-button--primary }
[Open example in GDevelop](https://editor.gdevelop.io/?create-from-example=3d-platformer){ .md-button .md-button--primary }

[![](/gdevelop5/behaviors/physics3d/platformer3d.png){ width="320" }](https://editor.gdevelop.io/?project=example://3d-platformer)
[![](/gdevelop5/behaviors/physics3d/platformer3d.png){ width="320" }](https://editor.gdevelop.io/?create-from-example=3d-platformer)

### Move a 3D shooter character

The "3D shooter gamepad mapper" behavior can be added to a [3d physics character](/gdevelop5/behaviors/physics3d) to make the character move according to player inputs automatically.

[Open example in GDevelop](https://editor.gdevelop.io/?project=example://3d-first-person){ .md-button .md-button--primary }
[Open example in GDevelop](https://editor.gdevelop.io/?create-from-example=3d-first-person){ .md-button .md-button--primary }

[![](/gdevelop5/behaviors/physics3d/first-person.png){ width="320" }](https://editor.gdevelop.io/?project=example://3d-first-person)
[![](/gdevelop5/behaviors/physics3d/first-person.png){ width="320" }](https://editor.gdevelop.io/?create-from-example=3d-first-person)

### Move a character with custom movement

Expand Down
6 changes: 3 additions & 3 deletions docs/gdevelop5/all-features/linked-objects/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ In this example, for every existing "Pathfinder" object, a new "Terrain" object

**Magnet**

[Open example in GDevelop](https://editor.gdevelop.io/?project=example://magnet){ .md-button .md-button--primary }
[Open example in GDevelop](https://editor.gdevelop.io/?create-from-example=magnet){ .md-button .md-button--primary }

**Pin objects**

[Open example in GDevelop](https://editor.gdevelop.io/?project=example://pin-object-to-another-multiple-parents){ .md-button .md-button--primary }
[Open example in GDevelop](https://editor.gdevelop.io/?create-from-example=pin-object-to-another-multiple-parents){ .md-button .md-button--primary }

!!! tip

The [Sticker](/gdevelop5/all-features/extensions/sticker) behavior also allows to pin objects.

**Basic artificial intelligence**

[Open example in GDevelop](https://editor.gdevelop.io/?project=example://basic-artificial-intelligence){ .md-button .md-button--primary }
[Open example in GDevelop](https://editor.gdevelop.io/?create-from-example=basic-artificial-intelligence){ .md-button .md-button--primary }

!!! tip

Expand Down
2 changes: 1 addition & 1 deletion docs/gdevelop5/all-features/storage/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Storage

Games can store data, such as the player progress. By default, nothing is persisted between game sessions. **Storage** actions and conditions are an easy way to persist information like the player best score, items, etc...

To see this in action, review the *[Save-Load example](https://editor.gdevelop.io/?project=example://save-load)* included with GDevelop.
To see this in action, review the *[Save-Load example](https://editor.gdevelop.io/?create-from-example=save-load)* included with GDevelop.

!!! note

Expand Down
3 changes: 2 additions & 1 deletion docs/gdevelop5/behaviors/.pages
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ nav:
- Anchor Behavior: anchor
- Destroy outside screen behavior: destroyoutside
- Draggable Object Behavior: draggable
- pathfinding
- Grid-based pathfinding: pathfinding
- Navmesh pathfinding: nav-mesh-pathfinding
- 2D Physics Engine: physics2
- 3D Physics Engine: physics3d
- Platform and platformer character behaviors: platformer
Expand Down
4 changes: 2 additions & 2 deletions docs/gdevelop5/behaviors/destroyoutside/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ The Destroy Outside behavior has two optional parameters that provide fine contr

**Destroy Bullets Outside Screen/Scene**

[Open example in GDevelop](https://editor.gdevelop.io/?project=example://shoot-bullets){ .md-button .md-button--primary }
[Open example in GDevelop](https://editor.gdevelop.io/?create-from-example=shoot-bullets){ .md-button .md-button--primary }

[![](Examples1BulletOutsideScreen.png){ width="320" }](https://editor.gdevelop.io/?project=example://shoot-bullets)
[![](Examples1BulletOutsideScreen.png){ width="320" }](https://editor.gdevelop.io/?create-from-example=shoot-bullets)

## Reference

Expand Down
16 changes: 8 additions & 8 deletions docs/gdevelop5/behaviors/draggable/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,33 +51,33 @@ When multiple draggable objects overlap, the object with the highest Z-order wil

**Snap to Grid**

[Open example in GDevelop](https://editor.gdevelop.io/?project=example://snap-object-to-grid){ .md-button .md-button--primary }
[Open example in GDevelop](https://editor.gdevelop.io/?create-from-example=snap-object-to-grid){ .md-button .md-button--primary }

[![](snaptogrid.png){ width="320" }](https://editor.gdevelop.io/?project=example://snap-object-to-grid)
[![](snaptogrid.png){ width="320" }](https://editor.gdevelop.io/?create-from-example=snap-object-to-grid)



**Shoot Bullet in Parabola Pattern** (A parabola is a plane curve which is mirror-symmetrical and is approximately U-shaped. Basically, an object that shoots toward an object in a curved trajectory.)

[Open example in GDevelop](https://editor.gdevelop.io/?project=example://shoot-bullet-in-parabola){ .md-button .md-button--primary }
[Open example in GDevelop](https://editor.gdevelop.io/?create-from-example=shoot-bullet-in-parabola){ .md-button .md-button--primary }

[![](shootbulletparabolapattern.png){ width="320" }](https://editor.gdevelop.io/?project=example://shoot-bullet-in-parabola)
[![](shootbulletparabolapattern.png){ width="320" }](https://editor.gdevelop.io/?create-from-example=shoot-bullet-in-parabola)



**Save and Load**

[Open example in GDevelop](https://editor.gdevelop.io/?project=example://save-load){ .md-button .md-button--primary }
[Open example in GDevelop](https://editor.gdevelop.io/?create-from-example=save-load){ .md-button .md-button--primary }

[![](saveandloadexample.png){ width="320" }](https://editor.gdevelop.io/?project=example://save-load)
[![](saveandloadexample.png){ width="320" }](https://editor.gdevelop.io/?create-from-example=save-load)



**Path Finding Basics**

[Open example in GDevelop](https://editor.gdevelop.io/?project=example://pathfinding-basics){ .md-button .md-button--primary }
[Open example in GDevelop](https://editor.gdevelop.io/?create-from-example=pathfinding-basics){ .md-button .md-button--primary }

[![](/gdevelop5/behaviors/pathfinding/pathfindingbasics.png){ width="320" }](https://editor.gdevelop.io/?project=example://pathfinding-basics)
[![](/gdevelop5/behaviors/pathfinding/pathfindingbasics.png){ width="320" }](https://editor.gdevelop.io/?create-from-example=pathfinding-basics)

## Reference

Expand Down
111 changes: 111 additions & 0 deletions docs/gdevelop5/behaviors/nav-mesh-pathfinding/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
title: Navigation mesh pathfinding
---
# Navigation mesh pathfinding

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.

## Choose the floors and the obstacles

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.

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.

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.

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

![](nav-mesh-obstacle-properties.png){ width="386" }

These properties are only relevant for [3D model](/gdevelop5/objects/3d-model) objects. The 2D collision mask is always used for 2D objects.

* **Shape** – You can choose between using the model shape (**Mesh**) or a bounding box (**Box**).
* **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.

!!! tip

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

!!! note

[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.

## Move objects while avoiding obstacles

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.

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

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

* **Acceleration** – How fast the object accelerates while moving on a path.
* **Max. speed** – The maximum speed the object can reach on the path.
* **Avoidance sight range** – How far ahead the character looks to avoid other characters.
* **Radius** – The radius of the character. This setting determines how close the object can move to obstacles.
* **Angle offset** – In case the sprite is facing the wrong direction, you can fix it with the angle offset.
* **Rotation speed** – The speed of the object's rotation.
* **Rotate object** – Disable it if you don't want the object to rotate while moving on the path.

!!! note

If you want to change how the object moves during the game, these properties can be changed using actions.

To make the character move, you need to add the **Move to a position** action and specify the destination.

For instance, to move a character to the cursor, you can do the following in 2D:

![](nav-mesh-move-2d.png)

or in 3D (using the [3d raycast](/gdevelop5/extensions/raycaster3d) extension):

![](nav-mesh-move-3d.png)

!!! warning

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.

!!! tip

In an isometric 2D game, set the **Y speed scale** scene property to `0.5` so that characters move slower vertically than horizontally.

## Avoid frame skipping when obstacles change

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.

You can reduce this side effect by:

- Making **Cell size** and **Cell depth** bigger in the scene properties.
- 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.
- Making a chunk system that destroys far away obstacles in batches.

## Troubleshoot navigation mesh generation

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

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

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

* **Max. stair height** – If characters won't climb stairs, try a greater value.
* **Slope max. angle** – If characters won't walk on steep slopes, try a greater value.
* **Walkable depth** – If characters won't go under a roof, try a smaller value.
* **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.

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

## Examples

!!! tip

**See it in action!** 🎮
Open these examples online.

**Isometric example**

[Open example in GDevelop](https://editor.gdevelop.io/?create-from-example=isometric-game){ .md-button .md-button--primary }

[![](isometric-game.png){ width="320" }](https://editor.gdevelop.io/?create-from-example=isometric-game)

## Reference

All actions, conditions and expressions are listed in [the navmesh pathfinding reference page](/gdevelop5/all-features/nav-mesh-pathfinding/reference/).
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading