Code Monkey home page Code Monkey logo

Comments (4)

SylvainBreton avatar SylvainBreton commented on September 16, 2024

I actually wrote a function to do this if it can be of any help.
I think that the output grid is far from optimal however.

from navmesh.

mikewesthad avatar mikewesthad commented on September 16, 2024

Sorry - I've been traveling, so slow to respond to issues this month. I'll look into this issue this week. Thanks for sharing that generate @SylvainBreton!

from navmesh.

SylvainBreton avatar SylvainBreton commented on September 16, 2024

sry, the link is dead following a merge request : here is a new one (once again far from optimal coding):
https://gitlab.com/eternal-twin/mush/mush/-/blob/develop/App/src/game/scenes/daedalusScene.ts

from navmesh.

mikewesthad avatar mikewesthad commented on September 16, 2024

A couple thoughts:

  • I'd recommend checking out @SylvainBreton's example.
  • If you are using a tilemap, or if your world can be represented on a grid, then you could try out the built-in navmesh/phaser3-navmesh API for generating the navmesh from a grid.
  • Beyond that, you'll have to roll your own solution for now. There are JS decomposition libraries out (like poly2tri) there that implement different approaches, e.g. a good algorithm might be constrained delaunay triangulation. It sounds like you want to define a poly for your whole map, then use the obstacles to define holes and then feed it into a decomposition algorithm that supports holes.
  • It's more tedious, but you can always generate meshes by hand via Tiled.

It's on the roadmap to support more navmesh generation techniques, but time has been limited. PRs welcome if you feel like contributing!

from navmesh.

Related Issues (20)

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.