Best way to detect floor collision

Hello, I would like to know what is the best way to detect if a CapsuleCollider is in contact with the floor.
My first thoughts were to send a raycast downwards though im not entirly sure how to implement that.
Could anybody help me with this or tell me a better way to solve it.
Thanks

You can tag the floor and check in OnCollisionEnter for that tag

I thought of this too however this would mean if any part of the capsule is in contact with the tagged object then it would register. I am developing a platformer and this would cause issues with the sides of the capsule touching raised platforms.

http://unity3d.com/support/documentation/ScriptReference/CharacterController-collisionFlags.html

http://unity3d.com/support/documentation/ScriptReference/CollisionFlags.html

http://unity3d.com/support/documentation/ScriptReference/CollisionFlags.Below.html

try those!

Kinos141’s is the best solution, but for CharacterController rather than capsule collider

There’s a solution that few ever bother to use, actually… Create a small trigger collider just under your object’s feet. Have that object hold a script that turns grounded on when an object enters it and enters it into an array of objects you’re on. When an object leaves it, find it in the array and remove it, then run a check to see if the array is empty. If it is, then set grounded to false.

The above has worked for me no matter what I’m using it for. Change gravity direction? No problem! The trigger is still under the feet. If you tried to figure out if you hit the side of something using Vector3.Dot, for example, that would only work in a static gravity environment.