Boxcast triggering triggers

I have this player and it uses a box-cast,
In order to check if there's ground beneath it.

But, it triggers the trigger when the player isn't actually in the area.
If I have a problem with the code here it is.

    private bool IsGroundedToFloor()
    {
        return Physics2D.BoxCast(coll.bounds.center, coll.bounds.size, 0f, Vector2.down, .1f, jumpableGround);
    }

This is the code that checks whether or not the player has contact with the floor.
And here's the code to check whether the player is touching the trigger:

    private void OnTriggerEnter2D(Collider2D collision)
    {
        logic.collisionNormal = true;
    }

    private void OnTriggerExit2D(Collider2D collision)
    {
        logic.collisionNormal = false;
    }

Which detects when the player is in the area and when it leaves.
So, is there a checkbox or different way/way to fix,
The code so that it doesn't trigger the trigger?


A query doesn't cause a trigger callback so I'm really not following what you're asking here. A query is a read-only operation, it doesn't change anything.

1 Like