SphereCast - RayCast

Hi, i’m new to Unity and i would ask information about raycast and spherecast.
I have a character with a capsule collider, first i applied a raycast to know if the character hits the ground but i have encountered problem with edges of solid (The character was stuck in air when he was between empty space and surface).
So i thought about applied a spherecast for more precision but i don’t know why
Physics.Raycast(transform.position + (Vector3.up * 0.1f), Vector3.down, out hitInfo, m_GroundCheckDistance + 0.1f)
is not equivalent to
Physics.SphereCast (transform.position + sphereRayon * Vector3.up, sphereRayon, Vector3.forward, out hitInfo, m_GroundCheckDistance)
(sphereRayon is radius of capsule collider)
?

Thanks for the replies

They should be equivalent. You forgot to state what the problem is. Is the spherecast not hitting something, or?

Thanks for your help :slight_smile:
Physics.Raycast(transform.position + (Vector3.up * 0.1f), Vector3.down, out hitInfo, m_GroundCheckDistance + 0.1f) hits the ground but Physics.SphereCast (transform.position + sphereRayon * Vector3.up, sphereRayon, Vector3.forward, out hitInfo, m_GroundCheckDistance) does not hit the ground

Probably because you’re shooting the raycast in the direction Vector3.down, but the spherecast in the direction Vector3.forward.