Colliders 2D
In Box2D there are two types of colliders: solid and sensor.
- Solid -> default collider which provides collision and other bodies with solid colliders cannot pass through it.
IsSensor
should befalse
. - Sensor -> collider which doesn't provide collision and other colliders pass through (overlap) it.
IsSensor
should betrue
.
In the image below you can see how the CircleCollider2D on blue NPC(on right) and CapsuleCollider2D on Player(left) have IsSensor=true
so they overlap with other shapes, unlike the BoxCollider2D on the Player and small CapsuleCollider2D on the NPC which are IsSensor=false
and they prevent them from falling from the horizontal rectangle which is BoxCollider2D with IsSensor=false
.

You can also set more precisely collider behaviour using Collision Matrix from Layer System
soon example will be added