Hello.
I am trying to add a explosive force at the hit position of the ray(hit.point)
var radius = 5.0;
var power = 10.0;
var hit : RaycastHit;
function Update ()
{
if(Physics.Raycast(transform.position, transform.forward, hit, Mathf.Infinity))
{
var colliders : Collider[] = Physics.OverlapSphere (hit.point, radius);
for (var hit : Collider in colliders) {
if (!hit)
continue;
if (hit.rigidbody)
hit.rigidbody.AddExplosionForce(power,hit.point, radius, 3.0);
}
}
}
But it is exactly not going very well. It is giving me the error “point is not a member of UnityEngine.Collider”.
I do not know how to fix that. Can you your incredibly handsome person possibly help me?