I have several AI driven characters that when moving keeps colliding with each other. How can I do to avoid this?
I am trying to acces the Rigidbody in the Character Controller component in order to set the IsKinematic property to true, but is not working. Is this the way to go? Is there a better solution? Why do I receive null when calling:
You can access the rigidbody component directly via transform.rigidbody
I presume you’re using Unity free, because if you’re using pro you would probably do better using the built-in NavMesh and NavMeshAgent.
Another possible approach to your problem that will solve collision between AI agents but still allow them to collide with the environment is to set them on a physics layer of their own and then set the collision matrix so that this layer won’t collide with itself.
Thanks, I tried accesing transform.rigidbody directly: doesn’t work. There is no Rigidbody on the GameObject. The Rigidbody is provided by the Character Controller, which inherits form Collider.
You are right, I am using Unity Free. How does the NavMesh works? What are they useful for?
But…YES! The layer trick solved it!!! Had no idea about this feature, I am learning. Awesome! Solution was only uncheking a checkbox…After 3-4 hours messing around!