- Home /
Use enemy as trigger just for the char ( not the ground )
Hey,
I'm making a 2D sidescroller game.
I hope the picture is self-explaining ;P
(While the enemy is set to trigger, he can walk through the char but cant fall down)

Regards,
LifeArtist
if you absolutely have to set trigger of the collider of enemy, you can add a second collider which is not trigger.
But when I'm adding a new collider, the enemy again pushes my char back ^^
ahh, I wasn't paying attention, you can set which layers will collide with each other from the collision matrix. so enemy would not collide with player layer, but would collide with others.
Answer by aceX · Apr 22, 2014 at 04:55 PM
You could use Layermasks to ignore the player's collider, while still using a second collider to stay above ground.
static void IgnoreLayerCollision(int layer1, int layer2, bool ignore = true);
//where layer 1 is your enemy's layer and layer 2 is your player's layer
http://docs.unity3d.com/Documentation/ScriptReference/Physics.IgnoreLayerCollision.html
Answer by LifeArtist · Apr 22, 2014 at 05:25 PM
Okay so ... this is i think what koray mentioned. I disabled for the enemy layer, the character layer.So when I want to find out if the character moves into the enemy, I have to set up a new collider with trigger on :)
But i have to parent a new GameObject with the new collider to my char.
Your answer