Raycast (450948)

This may be a dumb question? If so thats ok but is there a way to make a raycast thicker?

Instead of a thin radius is it possible to give it a thicker radius?

var power : float = 500.0;
var powerY : float = 200;

function Update () 
{
	var hit : RaycastHit;
	var geneStealer : GameObject;
	var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
	
	//Cant see it lol//Debug.DrawRay(Input.mousePosition, Vector3.forward * 50, Color.green);
	
	// (Vector3(Input.mousePosition.x, Screen.height - Input.mousePosition.y,0)
	var fwd = transform.TransformDirection (Vector3.forward);
	
	if (Physics.Raycast (ray, hit, 50)  Input.GetButtonDown ("Fire1")) 
	{
		var hitEnemy : GameObject = hit.collider.gameObject;

		if (hitEnemy.tag == "ball")
		{
			transform.rigidbody.isKinematic = false;
			transform.rigidbody.AddForce(Vector3(0,powerY,power));
		}

	}
}

The code above is what Im using which may not be relevant, but just in case this is what I got :stuck_out_tongue:

I don’t think there is any way to make it thicker as it is currently. Many people have already posted something asking about this as well.

If anything you could try casting multiples to achieve what your wanting

Couldnt you just use Physics.SphereCast , or am i reading something wrong here?

Thanks willc, Nice find, Im just not sure how to use it?

I get this error:

No appropriate version of 'UnityEngine.Physics.CapsuleCast' for the argument list '(UnityEngine.Ray, UnityEngine.RaycastHit, int)' was found.

Thanks Guys I think I found a solution :slight_smile: I’ll give the ball a bigger sphere collider :slight_smile: