#How to move circular around one object in unity?
1 messages · Page 1 of 1 (latest)
You'll want to look into pathfinding algorithms for that.
Unity already has a built-in pathfinding system that uses the A* algorithm and is sufficient for most use cases.
But you could also implement your own solution using either a custom implementation of A* or another algorithm, such as Dijkstra's Algorithm or Octrees.
Also I feel like the question is a little misleading; once you have "[multiple] mountains forming a wall" the "circular" part wouldn't apply anymore, after all.
Do you need a grid-system for every type of pathfind-system?
No.
Dijkstra's algorithm for example uses nodes iirc (as in, you define points and connections between them, give each connection a weight and the algorithm figures out the best path between two nodes based on that).
A* can use a grid, but Unity's NavMesh for example uses it (according to the documentation) with a navigation mesh, rather than a grid.
And Octrees are basically a volumetric nav mesh made out of non-uniform boxes.
Sounds complicated without a grid-system.. but that's likely because I haven't read anything about nodes😆 Having a grid-system makes good sense because there you can define if the current grid is occupied, walkable etc. Though I suppose a node-system is not that much different..?
Just a lot to grasp really, so many questions like : what if there's something in the way"
With a node system, you kinda simplify it even more. Rather than determining what is walkable and what is not, you just define paths that can be taken and combine multiple of those to get you to your destination.
Gonna go out on a limb here and assume that that's probably what satnavs do.
Does that mean nodes are faster? or more performant?
Then you increase the weight of the affected connection ig, so the algorithm avoids it.
ahhh, yeah that makes sense.. kindof starting to get it
I haven't benchmarked it, but I would think that it's both a question of the exact implementation of pathfinding algorithm you use, as well as the scale of the space you want to navigate.
Generally speaking though, I would indeed assume that node-based approaches are faster (though likely less suited for game environments).
For reference: This StackOverflow reply outlines how (some) map applications optimize their path finding.
My earlier assumption about them using (a form of) Dijkstra's algorithm seems to have been not unfounded 
Interesting modification of Dijkstras' algorithm, though you mentioned it being less suited for game environments? what is recommended for game environments?
From what I know, the most common approach in game design is to use nav meshes.
They give more detailed information about the environment than a standard grid. And they still allow the use of A*, which at this point has been tried and tested a lot.
Of course, for use cases that deal with 3-dimensional navigation (as opposed to 2D where agents stay attached to a surface - usually the ground), things become more complex.
That's where structures like Octrees can replace NavMeshes (Warframe for example uses this in its space levels).
Nodes on the other hand don't adapt very well to game environments, because automatically placing them may prove difficult, distributing them manually would be tedious, and if you don't place a huge amount, any paths you get will be rather predictable and offer little (or no) variation.
Awesome! =) will check out Octrees, as I do work with flying units :) I'm sure all of this will help the OP as well to make a decision
There's a talk by the Warframe devs on YouTube where they describe their approach in detail.
It's a little difficult to find and I don't have access to my bookmark rn, perhaps I'll link it later.
Would be great tbh
Oh, and if you're working in a 3d space, you can also look up the Optimal Reciprocal Collision Avoidance (ORCA) algorithm. Iirc Warframe also uses that one in addition to their path finding, to prevent collisions between agents.
Thanks! will certainly do :D