How to cast sphere cast without "out".

I need to check, if player hits ceiling. So there is my spherecast call:
if (!Physics.SphereCast(capsuleColider.transform.TransformPoint(capsuleColider.center), sphereCastRadius, Vector3.up, capsuleColider.height * 0.5f + 0, 1, whatIsGround))

But i have a compile error “argument 4 must contain “out””. I tried using Ray ray instead of first two arguments, but it didnt work neither

This isn’t a physics question, it’s a basic C# question and a need to look at the docs.

Look at the example, it uses the out keyword.

Yes, but when i use another function overload:
public static bool (SphereCast ray, float radius, float maxDistance = Mathf.Infinity, int layerMask = DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal);
i have the same problem and i cant figure out why

Just show code please, I cannot read what the above is.

Here’s how to post code . Honestly though, if you’re new to C# and how to call method then you should look at some tutorials TBH. If you provide the correct argument types then it’ll work. Compiler errors mean you’re just using it wrong.

Ok, so i’l explain it more clear. I’m using the codeline:

if (!Physics.SphereCast(capsuleColider.transform.TransformPoint(capsuleColider.center), sphereCastRadius, Vector3.up, capsuleColider.height * 0.5f + 0.1, whatIsGround))

so i know that this finction doesnt have such overload, but the unity docs says that i can use this:SphereCast(Ray ray, float radius, float maxDistance = Mathf.Infinity, int layerMask = DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal);
but when i rewrite my spherecast code like that:

Ray ray = new(capsuleColider.transform.TransformPoint(capsuleColider.center), Vector3.up);
if (!Physics.SphereCast(ray, sphereCastRadius, capsuleColider.height * 0.5f + 0.1, whatIsGround))

but I still have the same compile error as before. I dont understand why.

Ensure the types are correct.

ray = Ray
sphereCastRadius = float
capsuleColider.height * 0.5f + 0.1 = float (note that 0.1 is double, not float)
whatIsGround) = int (LayerMask)

If the types are correct then the compiler will know which you mean. If they’re not, it has no idea so is just guessing and what you might mean from three overloads.