User Tools

Site Tools


navmesh

Navigation Meshes

A navigation mesh is a joined set of polygons with geometric auxiliary data that informs an agent how to travel on the mesh.

WORM is capable of automatically generating navigation meshes in the Goldsource engine. A user is able to export navigation meshes on the fly post-generation.

Generating a Mesh

There are multiple ways of generating a navigation mesh.

Method 1: Manual Seeding

  1. Enter the game level you wish to generate a navigation mesh for.
  2. In each region, find an open space to place a coordinate seed via the command worm addnode
  3. Once a coordinate seed has been placed in every region, execute the command worm generate
  4. Wait for the mesh to generate.
  5. If WORM Editor is set to interactive mode, execute worm continue until the process finishes. Otherwise, it will finish automatically.
  6. The navigation mesh file will save to <root game directory>/addons/worm/data/nav/<map name>_#.sgd where # is an ID from 0-9 depending on what already exists.

Method 2: Automatic Seeding

  1. In order to perform automatic seeding, ensure that Autoseed is set to true in the configuration.
  2. Simply execute worm generate after entering a level.
  3. Wait for the mesh to generate.
  4. If WORM Editor is set to interactive mode, execute worm continue until the process finishes. Otherwise, it will finish automatically.

Editing the Mesh

Once the automatic generation process is completed, use worm load_spl # to load the mesh into the level, where # is the file ID . To unload the mesh, use worm unload_mesh.

In order to manually create a polygon, use worm addpoint to set the polygon's vertices, worm createpoly to create the polygon, and worm graft to append the element to the mesh.

You can also force connections in this way. Use worm addpoint to create the boundary determined by exactly two points. Then use worm select_node to select the target node. Go within the interior of the source polygon and execute worm forceconnect. If you are not satisfied with the result, you can use worm remove_connection to remove the connection to the target node.

After you are satisfied with your changes, you can use worm save_spl # to save the mesh as the desired ID.

Exporting Data

There are different ways of exporting data depending on the user's needs. See Exporting Meshes for more information. If you require the navigation mesh, then use the command worm export_mesh in order to save it in JSON format. Otherwise, you can use worm export_polys_raw to export only the mesh itself. In order to export shortest paths, execute worm export_paths.

navmesh.txt · Last modified: 2023/11/29 23:49 by wormadmin