I have player collisions working fine, using OnControllerColliderHit, but that won’t work for the fireball that my character shoots. What do I do to make the fireball recognize a collision with an object?
Here’s my code.
var fireBall : GameObject;
var shootPoint : Transform;
var SpikeDesPrefab : GameObject;
function OnColliderHit(hit: BoxCollider){
if(hit.gameObject.tag=="Spike") {
Destroy(hit.gameObject);
var instance0 : GameObject = Instantiate(SpikeDesPrefab, transform.position, transform.rotation);
}
}
function Update () {
transform.Translate(Vector3.forward * (Time.deltaTime*25));
}