Giter Club home page Giter Club logo

threejs-navmesh's Introduction

ThreeJS - Navigation Mesh

Screenshot Use RecastHelper to create a navigation mesh from ThreeJS geometry

  1. Add the threeJS library as folder three
  2. If you use npm install --save three, then change the importmap paths in example/index.html
  3. Import RecastHelper
import { RecastHelper  } from "../recast/RecastHelper.js";
  1. Create a new instance of RecastHelper. If the path to recast.wasm is not ../recast/recast.wasm then add the path as a parameter to the constructor.
const helper = new RecastHelper();
//If path const helper = new RecastHelper(PATH_TO_RECAST.WASM);
  1. Pass the scene or a Group and Params (optional) to the createNavMesh method of the helper
helper.createNavMesh(scene, {
  cellSize: 0.03,
  regionMinSize: 0.5,
  agentRadius: 0.3,
  agentHeight: 1.5
});

  1. createNavMesh is an async promise. Add a then. It will receive the created mesh.
helper.createNavMesh(scene, {
  cellSize: 0.03,
  regionMinSize: 0.5,
  agentRadius: 0.3,
  agentHeight: 1.5
}).then( (mesh) => { if (mesh){
  scene.add( mesh );
}
});

See the example for usage

threejs-navmesh's People

Contributors

niklever avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.