4

About the problem:

I have got a Player that has two scripts attached(PlayerController and Entity), a RigidBody(isKinematic checked, no gravity), NavMeshAgent and SphereCollider.

Then I have got two exactly the same Enemies that have two scripts attached as well(EnemyAI,Entity), a RigidBody(same),NavMeshAgent and SphereCollider.

Now the problem is that, I can go through them and they can go through each other as well. And this is something I definitely want to get rid of. To Move both enemy and player I simply use agent.destination. I put them also on different layers consequently "enemy" and "player" and marked to detect collision between them. Unfortunately that didn't appear to help.

And here goes my question. How to solve that? Thanks for your time and suggestions, hopefully they will lead me to the solution.

Heisenbug
  • 38,762
  • 28
  • 132
  • 190
Power
  • 141
  • 1
  • 11
  • If they both have NavMeshAgents, then they shouldn't be colliding with each other. Check that the radius and height properties of NavMeshAgent match the size of the object. – Andy Apr 22 '15 at 16:59
  • I tried the exact same setup you described and it works. And it's supposed to work. I think your problem is somewhere else. Which version of unity are you using? – Heisenbug Apr 22 '15 at 17:59
  • Actual :D Everytime Unity get's updated, mine gets aswell. Can you post the picture of your setup in Unity? would be grateful ;) Andy, please notice that I have rigidbody's isKinematic CHECKED. – Power Apr 22 '15 at 21:10
  • are they both controlled with a NavMesh Agent to move or your own MoveScript? – Aizen Apr 23 '15 at 12:22
  • Both moved by navmesh at least for standalone. For mobiles player will be controlled by joystick. – Power Apr 23 '15 at 13:13
  • @Power: yes when I have a few free time I'll write a quick overview of navigation and avoidance in unity. – Heisenbug Apr 24 '15 at 09:10
  • All I need is to see the setup so if you dont have a time, you can post a screenshot of your setup in Unity. – Power Apr 25 '15 at 08:22
  • @Heisenbug Are you there? – Power Apr 30 '15 at 07:32

1 Answers1

0

Finally I can say my issue is solved. All I had to do was to uncheck isKinematic, but! But, increase the mass of actors and set drag to 1 so they do not have such an influence on eachother, this also prevents single actors from flaying away from the scene.

Power
  • 141
  • 1
  • 11