Question by
Ilan1009 · Jan 21, 2021 at 02:56 PM ·
c#playerunity 2dplatformerplayer movement
Ground check BoxCast is detecting when player hits bottom of platform. UNITY 2D C#
Hello all! I am making an endless platformer.
private bool IsGrounded()
{
RaycastHit2D raycastHit2d = Physics2D.BoxCast(boxCollider2d.bounds.center, boxCollider2d.bounds.size, 0f, Vector2.down, 0.02f, platformsLayerMask);
return raycastHit2d.collider != null;
}
This is my ground check.
But I am having issues. IsGrounded is set to true, when head (top) of player is hitting bottom of platform (Basically Box cast is detecting top even though direction is set to down).
Like this:
Thanks, and please tell me if you need more info! (:
Comment