- Home /
How to make a collider be is trigger to some certain layers but be normal to others?
I want my enemy's collider is a trigger to the player (has a player layer) but is normal to other colliders. When the enemy touches the player it doesn't get stopped but the OnTriggerEnter2D (or OnCollisionEnter2D) still got called.
Answer by Klarzahs · Oct 24, 2020 at 08:14 AM
If you want to have your collider only work to certain layers (and therefore objects on those layer), go to Edit -> project settings ->Physics (or Physics 2d if you are using 2D collider). Scroll down where you can find the Layer Collision Matrix
@Klarzahs I want my collider to work with all layers but be isTrigger (don't collide but still called OnTriggerEnter2D or OnCollisionEnter2D) on some certain layers. It doesn't really need to be exactly like that but something that has that same effect.
Answer by seriouslee131 · 2 days ago
I also really need this. The collision matrix doesn't work here because then there's no way to tell if the object for which it should only a trigger touched it with it.
Your answer
Follow this Question
Related Questions
Detect multiple collisions with OnTriggerStay2d 2 Answers
OnTriggerExit2D Does not work 1 Answer
OnCollisionEnter fires, but OnCollisionExit does not 1 Answer
OnTriggers hit wrong 1 Answer