Hello, I need this code to add the force when I am holding my “fire1” button. Right now it only adds the force once.
var projectile : Rigidbody;
var speed = 20;
var explosionTime = 1.0;
var explosionRadius = 5.0;
var explosionPower = 2000.0;
function Update ()
{
if(Input.GetButtonDown ("Fire1"))
{
var colliders : Collider[] = Physics.OverlapSphere (transform.position, explosionRadius);
for(var hit in colliders)
{
if(hit.rigidbody)
{
hit.rigidbody.AddExplosionForce(explosionPower, transform.position, explosionRadius);
}
}
}
}
Any help or hints would be great ![]()