Giter Site home page Giter Site logo

gdx-recast's Introduction

image

gdx-recast

gdx-recast is a library for libGDX that provides a bridge between libGDX and the Recast/Detour pathfinding libraries. This is possible by using recast4j, a Java port of Recast/Detour.

GWT is supported by using a forked version of recast4j, gwt-recast which has been modified to work with GWT.

NOTE: This library is still in development. API changes may occur at any time.

Features

  • NavMesh generation (can use libGDX ModelInstances)
  • NavMesh saving / loading
  • Pathfinding
  • Detour Crowd (Experimental)
  • GWT support
  • Debug rendering for libGDX

Usage

Generating a NavMesh

NavMeshGenSettings settings = NavMeshGenSettings.Builder.SettingsBuilder()
        .useTiles(true)
        .tileSizeX(128)
        .tileSizeZ(128)
        .build();

// NavMeshGenerator provides multiple constructors
NavMeshGenerator navMeshGenerator = new NavMeshGenerator(modelInstance);
NavMeshData data = navMeshGenerator.build(settings); // Contains NavMesh

Saving / loading a generated NavMesh

// Saving
NavMeshIO.save(navMeshData.getNavMesh(), Gdx.files.internal("navmesh.nav"));

// Loading
NavMesh navMesh = NavMeshIO.load(Gdx.files.internal("navmesh.nav"));
NavMeshData navMeshData = new NavMeshData(navMesh);

Pathfinding

private Pathfinder pathfinder;
...
pathfinder = new Pathfinder(navMeshData);
        
Array<float[]> paths = new Array<>(); // This will be populated with the path
pathfinder.getPath(new Vector3(-0.99f, 15.24f, 11.98f), new Vector3(17.63f,-2.37f,-21.86f), paths);

Resources

Recast Navigation Google Group

Recast4j

gdx-recast's People

Contributors

jamestkhan avatar antzgames avatar

Watchers

 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.