.. _platformer-wall-hit-checker-page: Platformer Wall Hit Checker =========================== This component is used to check if a ``GameObject`` can be considered colliding with walls. You can configure any of the 6 points of detection through inspector. The points are: * Upper Right * Upper Left * Center Right * Center Left * Lower Right * Lower Left What it Requires ---------------- Through Unity's inspector you will need to inform what layers of your project should be considered wall. A ``Collider2D`` is required. It might be a ``BoxCollider2D``, a ``CapsuleCollider2D`` or even a ``CircleCollider2D``. You can directly specify one (pretty handy in case you are using multiple colliders). If no ``Collider2D`` is provided the component will try finding one. .. important:: If you are working with multiple colliders be sure to specify one. Otherwise the wrong one might be used instead. What it Implements ------------------ .. table:: :width: 100% :widths: 100 +-----------------------------------------------+ | **Interface** | +-----------------------------------------------+ | ``IPlatformerWallHitDataProvider`` | +-----------------------------------------------+ What it Provides ---------------- Properties ********** You can directly access the public properties listed below and benefit from its information. .. code-block:: csharp public bool HittingWall; public WallHitData Data; Events ****** You can add listeners through code or inspector to be updated every physics update about the ``GameObject`` being or not hitting walls. .. code-block:: csharp public UnityEvent WallHitDataUpdate; .. note:: If you are not familiar on how to use Unity Events `check out the oficial docs `_ . Checkout what is the :ref:`WallHitData ` composed of for more information about how it can be usefull to you. Seeks For --------- Nothing. .. _wall-hit-data: WallHitData ----------- .. code-block:: csharp namespace Handy2DTools.CharacterController.Checkers { public class WallHitData { /// /// If hitting any walls /// public bool hittingAnyWall = false; /// /// True if hitting any wall to the left /// public bool leftHitting = false; /// /// /// public bool rightHitting = false; /// /// True if hitting a wall with the top right corner /// public bool upperRight = false; /// /// The top right corner hit angle /// public float upperRightHitAngle; /// /// True if hitting a wall with the lower right corner /// public bool lowerRight = false; /// /// The lower right corner hit angle /// public float lowerRightHitAngle; /// /// True if hitting a wall with the center right checker /// public bool centerRight = false; /// /// The center right hit angle /// public float centerRightHitAngle; /// /// True if hitting a wall with the top left corner /// public bool upperLeft = false; /// /// The top left corner hit angle /// public float upperLeftHitAngle; /// /// True if hitting a wall with the lower left corner /// public bool lowerLeft = false; /// /// The lower left corner hit angle /// public float lowerLeftHitAngle; /// /// True if hitting a wall with the center left checker /// public bool centerLeft = false; /// /// The center left hit angle /// public float centerLeftHitAngle; } }