Capsule Collider 2d Acting like box collider. (Also, updated unitychan script for those with issues)

So, I was messing around with this since it’s out now. And there are some issues that I’ve had to combat in the past (I’m the programmer for tilemaster, which these features will be replacing soon). Number one, and the biggest hurdle is that when you have two colliders (polygon or box colliders) right next to each other, the character catches on those tiles. This is pretty sucky as it stops the character in it’s tracks. Being a capsule should have fixed this, but it didn’t. In fact, though the capsule looks like a capsule, it’s actually just a box collider at the moment.

It’s easy enough to tell just by partially walking off an edge.

Here is a capture of the catching issue cause of this. (this further shows a box collider in action instead of a capsule collider as it’s the side of the capsule getting stuck, not the bottom)

This is quite annoying. Is this intentional? or is this another of many things not fully implemented?

Lastly, there is quite the bug with the unitychan movement script. It doesn’t check for collisions below, it simply looks to see if it’s overlapping with the ground. Problem with this is that you can then scale walls with ease. Only takes a smidgeon more effort, but it’s pretty much fixed by replacing the fixed update with the following

(this is mainly for other people that may be having issues since the current method effectively gives you infinite wall and ceiling jumping)

    void OnCollisionStay2D(Collision2D col)
    {
        GroundedCheck(col);
    }

    void OnCollisionExit2D(Collision2D col)
    {
        GroundedCheck(col);
    }

    void GroundedCheck(Collision2D col)
    {
        m_isGround = false;
        if (m_rigidbody2D.velocity.y <= 0)
        {
            foreach (ContactPoint2D contact in col.contacts)
            {
                if (contact.point.y <= transform.position.y - m_CapsuleCollider2D.bounds.extents.y)
                {
                    m_isGround = true;
                }
            }
        }
        m_animator.SetBool("isGround", m_isGround);
    }

It’s a known bug that was reported just after the release. If you look, capsule/capsule contact works as expected but the bug is between capsule/polygon contact.

This is being fixed.