JoyAlbertini / Unity-3Dnavigation

A 3D navigation system for Unity featuring space discretization with an octree and path planning using A* Lazy Theta ecc..
3 stars 0 forks source link
3d-path-planning dual-graph octree-partitioning pathplanning unity3d

3D Navigation with Octree in Unity

Builds

Windows build (need to unzip it)

Video

Alt text

Watch the video

Full text

Project pdf

Project Overview

This project introduces a 3D navigation system to the Unity game engine, which traditionally only supports navigation on surfaces (NavMesh). The system utilizes an octree data structure to discretize 3D space and implement obstacle avoidance for agents, allowing for efficient path planning in three-dimensional environments.

Features

Objectives

  1. Octree Creation: Efficiently discretize 3D space with an octree structure.
  2. Dual Graph Creation: Generate a graph from the octree for path planning.
  3. Agent Path Planning: Implement and test various path planning algorithms.
  4. Movement of Agents: Ensure realistic movement of agents using optimized paths.

Implementation Details

Octree Structure

Path Planning

  1. **A***:
    • Combines distance from the source and a heuristic to the goal.
    • Uses a priority queue for efficient node expansion.
  2. Post-Smoothing:
    • Enhances paths by reducing unnecessary turns and optimizing length.
  3. Theta* Variants:
    • **Basic Theta***: Checks for direct lines-of-sight to improve paths during the search.
    • **Lazy Theta***: Uses lazy evaluation to minimize line-of-sight checks, improving performance.

Multi-Target Single-Source Optimization

Results

Installation Guide

To add the Git package to Unity, follow these steps:

  1. Copy the following URL:
    https://github.com/JoyAlbertini/Unity-3Dnavigation
  2. In Unity, navigate to Window > Package Manager.
  3. Click the + button and select Add package from git URL.
  4. Paste the copied URL and click Add.

The Git package includes all necessary dependencies, making it plug-and-play. Specifically, it contains:

Example

You can import an example scene from the Git package (ExampleScene). However, make sure to install Unity TextMeshPro first.

Missing Implementations

I will update this old codebase if there is interest.

Feel free to reach out with any questions or feedback!

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments