Coder Social home page Coder Social logo

taiyoungjang / recast-detour Goto Github PK

View Code? Open in Web Editor NEW

This project forked from edwin0cheng/recast-detour

0.0 0.0 0.0 37 KB

A simplified (detour only) rust binding for Recast & Detour library

C++ 24.48% C 5.39% C# 9.64% Rust 58.16% CMake 2.33%

recast-detour's Introduction

recast-detour-rs โ€ƒ Latest Version

This project do not and will not be a full function Recast & Detour library.

This project do the followings things

  • Use cmake crate to build the Recast & Detour c++ library.
  • Add an very simple c-api for Detour Query.
  • Manual binding for that c-api in rust crate (recast-detour-sys)
  • An actual rust crate for provide a better usage (recast-detour-rs)
  • An augmented obj file format reader for reading NavMesh from a file
  • An demo implementation for Unity NavMesh Exporter

Basic Usage

#[cfg(test)]
mod tests {
    use super::*;
    use insta::*;

    fn simple_mesh() -> NavMeshData {
        let vertices = vec![
            0.0, 0.0, 0.0, 10.0, 0.0, 0.0, 10.0, 0.0, 10.0, 0.0, 0.0, 10.0,
        ];

        let indices = vec![0, 1, 2, 0, 2, 3];

        NavMeshData {
            vertices,
            indices,
            walkable_height: 0.2,
            walkable_radius: 0.2,
            walkable_climb: 0.2,
            cell_size: 0.1,
            cell_height: 0.1,
        }
    }

    #[test]
    fn test_simple_path() {
        assert_eq!("0.0.1", version());
        let mesh = simple_mesh();

        let q = RecastQuery::new_from_mesh(mesh).unwrap();
        let p = q
            .find_path((0.2, 0.1, 0.4).into(), (0.8, 0.1, 0.5).into(), 0.2)
            .unwrap();

        assert_debug_snapshot_matches!(p, @r###"Point(
    [
        0.29999924,
        0.0,
        0.29999924
    ]
)"###);
    }
}

recast-detour's People

Contributors

edwin0cheng avatar edwin0minv avatar taiyoungjang avatar setzer22 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.