Raycast First and primitive forms

Below is my code:

function checkGround(entity) {
    var from = entity.entity.getPosition();
    var to = new pc.Vec3(from.x, from.y - 6, from.z); //correcting distance

    var result = entity.app.systems.rigidbody.raycastFirst(from, to);

    if (result) {
        var distance = from.distance(result.point);
        entity.app.drawLines([from, result.point], [pc.Color.RED, pc.Color.WHITE])
        return distance;
    } else {
        return 20;
    }
}

When it hits an entity that has a mesh collision, it works, but if it hits a simple collision like: cube, cone, etc. It doesn’t work, the collision is ignored, is there a way to fix this?