Need help with creating a way to check if player is on a surface they can jump on.

The above image shows the setup I am using. The larger sphere collider is the ground collider which the player uses to smoothly move over objects such as stairs. The smaller sphere collider is the jump detecter. Its purpose is to test if the ground / a surface the player can jump on is directly beneath the player. I have set the larger sphere to ignore raycasts buy when I use:

    private void Update()
    {
        UpdateCursorAndMobility();

        rotUD = Mathf.Clamp(rotUD, -80, 80);
        playerNeck.transform.localEulerAngles = new Vector3(-rotUD, 0, 0);

        //Check if the player is touching a surface they can jump on:
        RaycastHit hit;
        grounded = Physics.SphereCast(jumpTester.transform.position, 0.65f, Vector3.down, out hit, 0.1f);

        if (Input.GetKeyDown(KeyCode.P))
        {
            developerMode = !developerMode;
        }
        if(mobile == true)
        {
            MovementControls();
        }
        if(playerData.health > 0)
        {
            UIControls();
        }
    }

The value “grounded” always remains false even if the player is touching the ground.
Note that the collider radius of the jump detector is set to 0.3. The jump detector is also a “Is Trigger” collider.

Thanks in advanced.

I use this:

public class GroundCheck : MonoBehaviour
{
    public LayerMask groundLayer;
    public bool isGrounded {get; private set;}

    private void OnTriggerEnter(Collider other)
    {
        if (getRealLayerValue(other.gameObject.layer) == groundLayer)
            isGrounded = true;
    }

    private void OnTriggerExit(Collider other)
    {
        if (getRealLayerValue(other.gameObject.layer) == groundLayer)
            isGrounded = false;
    }

    private int getRealLayerValue(int gameObjectLayer)
    {
        return 1 << gameObjectLayer;
    }
}

creating a sphere, cube, whatever and place it on the player feet, with isTrigger enabled. I attach the script above to it.

In player controller script just use this (simplified version):

public class CharacterControllerScript : MonoBehaviour
{
    public GroundCheck groundCheck;
    public float jumpForce = 10f;
    Rigidbody rb;

    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        if (groundCheck.isGrounded && Input.GetKeyDown(KeyCode.Space))
        {
            rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
        }
    }
}

Now, jumpTester.transform.position = middle of your character.
You need to replace the position using (jumpTester.center + jumpTester.transform.position) - new Vector3(radius, radius, radius)

Later edit: new Vector3(radius, radius, radius) is not ok… just substract the radius on the Y axis … or just use an V3 offset