Capsule Collider Third Person Controller hanging on a ledge issue.

Hello, I am using a standard third-person-controller from the asset store but if I jump on a ledge of a collider the player is stuck hanging on the ledge.
Below is a screenshot to explain my problem.

As you can see the capsule collider collides with the cube and the player-controller thinks it is still airborn

If the controller is performing a raycast to test for grounded condition, consider doing a spherecast with the same radius as the collider instead.

I don’t know how the controller works, but it could be a solution.

My old answer was kinda poo, here’s a far better one:

[SerializeField] private LayerMask m_GroundCheckLayers = 1 << 0;
[SerializeField, Min(0)] private float m_GroundCheckOffset = 0.1f;

private CapsuleCollider m_CharacterCollider;

private void Awake()
{
    m_CharacterCollider = GetComponent<CapsuleCollider>();
}

private bool CheckIsGrounded()
{
	const float skinWidth = 0.01f;
	var center = transform.position + Vector3.up * m_CharacterCollider.radius;
	return Physics.SphereCast(center, m_CharacterCollider.radius - skinWidth, -transform.up, out _, m_GroundCheckOffset + (skinWidth * 2), m_GroundCheckLayers);
}

This will create a sphere cast that’s slightly smaller than your capsule collider (m_CharacterCollider) and shoot it downward kinda like this: Imgur: The magic of the Internet

The part of the yellow arrow that passes the blue line is the ground check offset, you can use this to increase the distance between the capsule and the ground that would still allow the character to be considered “grounded”.

If the “CheckIsGrounded” function returns true, your collider is on the ground.