Character controller and nav meshes

I have just started to look at the free version, and have a few beginner questions.

I got the first tutorial all working and then moved onto setting up one of my characters using the AIPath script that is included in the package. When I add character controllers to my units, they work great, but I read elsewhere that character controllers are slow. I tried removing them and the character flies around randomly, so what are the alternatives, especially for iPhone?

Thinking of iPhone, what is the best graph type to use? I tried making a navmesh myself, but the results where not fantastic, however I will be buying the pro version if I get everything working, so at least I wont have to build my own then. Really I’m just trying to work out what the best type of graph is with the limitations of mobile devices?

I’m looking to control about 10 to 15 units on an iphone, all chasing the main player. I got this all working great on Unitys built in navMeshes, but there was a lot of colliding and pushing of the main character. This didn’t look good at all, which is why I’m now looking at A* instead.


Hm, there might be a bug with the AIPath script not using character controllers. You can fix it by opening the AIPath script and finding the line which calls transform.Translate (possibly tr.Translate) and making sure that it also passes the argument Space.World
transform.Translate (forwardDir*Time.deltaTime, Space.World);
Note that when not using character controllers, no collision will take place.
Depending on the game, you could try force based avoidance (e.g UnitySteer).

Navmeshes are the fastest graphs because of their low node count in relation to how much of the game world they describe. They would work great on the iPhone as well. If you can reduce it to point graphs or small grid graphs that would also work depending on your game.
If you do buy pro, you have the next update to look forward to, because then I am including a complete local avoidance system. It will enable you to get crowds of units moving nicely and with great performance (I can get 500 units colliding at once easily on my computer, with character controllers that would (I think at least, not tried it) slow the game down to a halt).

Thank you for the reply.
After reading it I just loaded up your example scenes and removed the character controllers, which caused a few movement problems like I was getting on my test scenes. After looking through the AIPath script, I found where you translate the object and added in Space.World. This fixed the problem, so thanks for that.

I will be going pro very soon, any idea when the next update will be ready?

Not really, I am working on a bunch of different things at the moment, so I am not sure when I will have time to complete it. The local avoidance part is basically done though.

Thanks for flagging this! I was having this exact problem as well. I thought I saw in some other thread somewhere something about a performance problem in AIPath due to the use of FixedUpdate()? It would be great if you put all the little bug fixes you know of in a single thread somewhere for easy finding so we can self patch our copies of A* while we wait for the next official release. Thanks!

Here is the current source for the AIPath.cs script. It is not fully compatible with 3.1.4 but I think that will be easy fixes.

But really, the CharacterController is not fast when many units are colliding, it works best when the units only collide with static geometry, at least I have found this to be the case.

Oops, accidentally posted an old version of the script without the transform.translate bug fixed. Here is a new one

Just to add to your character controller comment; it’s a lot more obvious on an iphone and with one test I had 15 units all path finding fine, until they walked into each other. At this point my iphone just couldn’t handle it and it dropped to about 2 frames per second. Using the same scripts but switching to rigid bodies, it stayed at 30 frames per second with no problems.