Jump when touching the ground challenge - RigidBody2D vs. CapsuleCollider2D

Hi,

The Rigidbody2D acts as a compound collider whose shape matches the shape of all colliders attached to this game object and its children. If you just want to check if a specific collider is touching a layer, you must call the IsTouchingLayers method on the collider. If it does not matter or if you want to to check if the compound collider is touching a layer, you call the method on the rigidbody.

Use the version which solves the problem for you. If both solutions solve it, use the one you prefer.

Did this answer your question?


See also:

2 Likes