If you are using a RigidBody you can turn on Continuous collision detection.
CastRay will use a raycast to detect passthorugh.
And Cast Shape will use a shapecast that is more precise, but much more expensive
If you are using a RigidBody you can turn on Continuous collision detection.
CastRay will use a raycast to detect passthorugh.
And Cast Shape will use a shapecast that is more precise, but much more expensive