I’d like my enemies to explode into rigidbody pixels on death. The pixels work delightfully once they’re instantiated, but I’ve hung myself up somehow on the instantiation command. I can’t figure out why I get an “Array index is out of range” message.
The array “points” contains the spots where these pixels will come into being.
var pixelPrefab : GameObject;
var points : GameObject[];
var pixels : GameObject[];
function OnTriggerEnter(other:Collider){
if (other.tag == "Killzone"){
for (var i=0;i<points.length;i++){
pixels <em>= Instantiate(pixelPrefab, points_.transform.position, points*.transform.rotation);*_</em>
* }*
* for (var hitMe : GameObject in pixels){*
* hitMe.rigidbody.AddExplosionForce(1000,transform.position,0);*
* }*
* Destroy(gameObject);*
* }*
}