Giter VIP home page Giter VIP logo

godot_2d_navmesh_generator's Introduction

Godot 2D Navmesh Generator

Preview Image

A tool for generating a navigation mesh from collision data in a 2D scene. Implemented and tested in Godot 3.2.3.

PRs are welcome, no guarantees on a swift review though.

Installation

If your Godot project is tracked with Git, it is recommended to install this as a Git submodule. This means you can easily pull down updates. From your project root:

git submodule add https://github.com/samuelbigos/godot_2d_navmesh_generator addons/godot_2d_navmesh_generator

If you're not tracking on Git, download the repo and place into the 'addons/godot_2d_navmesh_generator' directory.

Usage

  1. Add a NavigationPolygonInstance to your scene (see documentation).
  2. In the Inspector menu, add a new NavigationPolygon and make sure it's selected.
  3. In the bottom panel you should see a tab NavmeshGen. Click it.
  4. Use this menu to generate a mesh for your NavigatonPolygon.

Demo

A demo project is included (2d_navmesh_generator_demo.zip), it includes basic navmesh agent and some collision shapes to generate a navmesh from.

Known Issues and Gotchas

  • 'Holes' in topology are not supported (yet). This means if you have a donut shape, the hole will be filled in. The solution for now is to leave a gap somewhere (and make it big enough for your agent width), then fill in the gap manually.
  • After generating, re-select the NavigationPolygonInstance node a few times in the editor to bring up the polygon editing interface.
  • Settings are not saved and will reset to default when re-selecting the node.
  • Generation time cost increases with square of scene size, which can be unoptimal for large scenes. Try and split your scenes up into multiple navmeshes if possible.
  • Works better if most straight lines are axis-aligned. This is because the scene is rasterized before being converted to a mesh, and diagonal lines introduce aliasing.
  • Only tested on Godot 3.2.3 and GLES3, might not work on other versions.

Next Steps

  • Fix known issues.
  • Create an API to generate programatically (for procedurally generated scenes).
  • Port to GDNative for performance.
  • Clean up and properly comment code.
  • Suggestions welcome!

Changelog

v0.1: Initial release for Godot 3.2.3

  • Initial release.

godot_2d_navmesh_generator's People

Contributors

samuelbigos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

godot_2d_navmesh_generator's Issues

Godot 3.5 support

There are multiple errors preventing this plugin to work on anything other than Godot 3.2. I would love to port this plugin to 3.5 but run into some errors I can't start to solve because the implementation is fairly big. Is there some way to contact you directly and ask some questions about the structure of the plugin?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.