Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Vecna on December 20, 2014, 06:14:31 PM

Title: How can I make 2 enemies not collide with each other?
Post by: Vecna 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?
Title: Re: How can I make 2 enemies not collide with each other?
Post by: markadet on December 20, 2014, 06:31:15 PM
You can use the layer collision matrix of Unity.
(http://docs.unity3d.com/uploads/Main/LayerCollisionMatrix.png)
With this you can choose if colliders of the same type collide with each other or not.

http://docs.unity3d.com/Manual/LayerBasedCollision.html (http://docs.unity3d.com/Manual/LayerBasedCollision.html)
Title: Re: How can I make 2 enemies not collide with each other?
Post by: Vecna 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.
Title: Re: How can I make 2 enemies not collide with each other?
Post by: Vecna 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.
Title: Re: How can I make 2 enemies not collide with each other?
Post by: wheretheidivides 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