playMaker

Author Topic: How can I make 2 enemies not collide with each other?  (Read 5011 times)

Vecna

  • Playmaker Newbie
  • *
  • Posts: 14
How can I make 2 enemies not collide with each other?
« on: December 20, 2014, 06:14:31 PM »
I'm having a real hard time making my ai enemies not go into each other. I'm using playmaker to move them towards the player. The only way they don't collide is when I make them rigid bodies but then my player can push them around.

What is the best way to solve this?

markadet

  • Playmaker Newbie
  • *
  • Posts: 20
Re: How can I make 2 enemies not collide with each other?
« Reply #1 on: December 20, 2014, 06:31:15 PM »
You can use the layer collision matrix of Unity.

With this you can choose if colliders of the same type collide with each other or not.

http://docs.unity3d.com/Manual/LayerBasedCollision.html

Vecna

  • Playmaker Newbie
  • *
  • Posts: 14
Re: How can I make 2 enemies not collide with each other?
« Reply #2 on: December 20, 2014, 07:47:20 PM »
It only works if the enemies have rigid bodies but when they pump into each other they push each other with great velocity even when their mass is set to 99.

Vecna

  • Playmaker Newbie
  • *
  • Posts: 14
Re: How can I make 2 enemies not collide with each other?
« Reply #3 on: December 21, 2014, 09:41:10 AM »
There must be a way to make enemies not collide inside each other and have the player not be able to push them around. I have tried making a trigger make the movement speed 0 but that also doesn't work.

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
Re: How can I make 2 enemies not collide with each other?
« Reply #4 on: December 23, 2014, 10:47:51 PM »
Make a collision sphere that is bigger.  So you have 1 collision sphere just around the player for collision.  You create a 2nd one that is 2 meters away.  Then you check to see if player 2 has entered the 2nd sphere of player 1.  Make sense?

So basically, you create multiple collision spheres on a character and when something enter the biggest one, you have the other player do something.  So when a enemy enters the outer collision spehere, you tell that enemy to go somewhere else.

Here is a link to a video series going into depth about this.  It is in javascript, but you will get a good understanding of colliders on a player to do stuff.

http://www.walkerboystudio.com/html/unity_training___free__.html