Before I buy - NavMesh on runtime

Hello,

I m looking for a navigation solution and before I buy I have some questions.

My project is heavily based on MapMagic so the terrains are procedurally generated, so my target is to build navmesh in runtime, I only care about navmesh because the AI agents of my game use navmesh agents to move.

Is that possible with A* and how easily is going to implement it? Also how fast will it build the navmesh on each terrain ?

Best regards

Hi

Yes it is possible to recalculate the navmesh during runtime.
See this page: https://arongranberg.com/astar/docs/graph-updates.php

The performance depends on which graph type you are using and the resolution of it.
A grid graph is the fastest usually and can take anywhere from a few milliseconds to around a second to scan (perhaps more for very large graphs). Recast graphs take significantly longer to scan, usually from a second or so up to several minutes (or more for very large worlds).

Note that this package is different from Unity’s navmesh system. It does not use the NavmeshAgent component for movement.

Thank you for your reply @aron_granberg . My concerns are that the framework I’m using (ORK) uses navmesh, but has the option for custom navigation system, which asks the following:

I m not too shavy when comes to scripting, but I guess I would need a new script to connect with your Nav system?

I would buy your asset in a blink if I had an idea how to intergrate it with ORK. I would be glad if you could help me.

Also this is the script that ORK uses to implement polynav tool, maybe it would help you understand if a script like this can altered to fit your asset.

using UnityEngine;
using System.Collections;

namespace ORKFramework.Behaviours
{
[RequireComponent(typeof(PolyNavAgent))]
[AddComponentMenu(“ORK Framework/Controls/ORK Poly Nav 2D Wrapper”)]
public class ORKPolyNav2DWrapper : MonoBehaviour
{
// Version: 1.0.0
private PolyNavAgent agent;

	void Start()
	{
		this.agent = this.GetComponent<PolyNavAgent>();
	}

	public void SetSpeed(float speed)
	{
		if(this.agent != null)
		{
			this.agent.maxSpeed = speed;
		}
	}

	public void SetDestination(Vector3 position)
	{
		if(this.agent != null)
		{
			this.agent.SetDestination(position);
		}
	}

	public void Stop()
	{
		if(this.agent != null)
		{
			this.agent.Stop();
		}
	}
}

}

Hi

That seems to be a wrapper for PolyNav2D. Maybe you can check if it has a wrapper for the A* Pathfinding Project as well?

@aron_granberg I checked, it only has for polynav, and I posted the code above, can it altered to fit your script also?

It can.
I think it is easiest with the beta version, it has a few more properties that are helpful.

Essentially this is what the methods would do:

IAstarAI agent = GetComponent<IAstarAI>();

SetSpeed(speed): agent.maxSpeed = speed;

SetDestination(position): {
    agent.isStopped = false;
    agent.destination = position;
}

Stop(): agent.isStopped = true;

I am not completely sure how they use the Stop method, but I think the above behaviour should be a good approximation.

Beta version? Can I test it with the free version before I buy or I need the pro from the begining? I would pay more than 100 for a solution to this :slight_smile: If you could also give me the methods for the other 2 would be really nice (Potition and stop method name). edit:ah it seems you already did, also what is the component that the AI agents that need to have in the prefab?

You can download the free beta version on the package website.

1 Like