Converting Physics.Raycast into Capsule Problem


I have a physics raycast from Camera.main.ScreenPointToRay (Input.mousePosition). Is it possible to have it cast a capsule?

I've tried messing around with it and I can never seem to get it to work. Here is my current script which works by using a simple line:

function Update () {
    var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
    var layerMask = 1 << 8;

    if (chooseLocation) {
        layerMask = ~layerMask;
        Physics.Raycast (ray, hit, 600, layerMask);
        Debug.DrawLine (ray.origin, hit.point);
        dummyObj.Translate((Vector3(hit.point.x, dummyObj.position.y, hit.point.z) - dummyObj.position)); // * Time.deltaTime *followSpeed
        currentHit = hit;
        CustomCurser.showOriginal = false;


So, how would I use a capsule instead of a line? I tried:

Physics.Raycast (0, 100, 5, ray, hit, 600, layerMask);

But no luck, i just get an int error, suggesting that I have a value in the wrong place somewhere?

Any help would be appreciated.

Should be. Try this to get the screenpoint:

Then this for the capsulecast: