Documentation/Entity Types/Special/GridBasedNavigationSystem.type

From NeoAxis 3D Engine Wiki

Jump to: navigation, search
Go to higher level

Contents

Description

GridBasedNavigationSystem is used to find a path between two points on the map. This object implements a 2D grid path finding algorithm.

GridBasedNavigationSystem can be used on maps geometry of which is nearly tied to the grid. These are maps based on a terrain. If the geometry doesn't correlate to the grid well, the use of the RecastNavigationSystem type is preferred.

In SDK the GridBasedNavigationSystem type is used on the Maps\RTSDemo\Maps\Example\Map.map map.

GridBasedNavigationSystem 01.jpg

Configuring

Creation

To add the object on the map, select the Base\Types\Pathfinding\GridBasedNavigationSystem type and left-click in the workspace.

GridBasedNavigationSystem 02.jpg

After you add a pathfinding system, you should adjust its parameters in accordance with the map it belongs to. Among parameters are grid bounds (GridBounds) and cell size (GridCellSize). Also, if the map is based on the HeightmapTerrain type, you can turn on the HeightByTerrainOnly option. If on, GridBasedNavigationSystem takes into account only terrain-based height.

GridBasedNavigationSystem 03.jpg

Calculation

Whenever you change object settings or edit the map, you should click the Update button in the properties window.

GridBasedNavigationSystem 04.jpg

Testing

To test pathfining, click the Test button in the Properties window. As you do, move the cursor to a point on the map. Then, hold the left mouse button and move the cursor the the next point. The path found by the pathfinding system will be displayed from the first point on the map to the point under the cursor.

To end the test, click the Test button again.

GridBasedNavigationSystem 05.jpg

There are also two more parameters in the bottom part of the properties window that you can also use to test the pathfinding system.

Title Description
Smooth the path in test mode Turn on/off smoothing of the found path. If on, all straight sections following each other are merged into a single section.
Visualize path finding in test mode Turn on/off pathfinding visualization. If the flag is on, path visualization also displays all variants tested by the pathfinding system.

Properties

Title Description
class Entity
Components List of attached components.
LogicClass Reference to the Logic Editor class. Read more about how to work with the Logic Editor class.
Name Object name.
Tags User defined information. Defined as keyvalue pairs. It is used for user's needs.
Type Object type. It can not be changed.
class GridBasedNavigationSystem
AgentHeight Minimum height a character can pass under.
AgentMaxSlope Maximum slope angle a character can walk, in degrees.
AlwaysDrawGrid Turn on/off constant visibility of the navigation grid.
DrawGridDistance A distance to limit grid drawing.
GridBounds Navigation grid bounds.
CellSize Navigation grid cell size.
HeightByTerrainOnly Turn on/off terrain-based height calculation (HeightmapTerrain).