Hi, I’m making a simple shooter game in unity and i have set up the bullet prefab that is fired by all players like so;
var rot : Quaternion;
function Update () {
}
function OnCollisionEnter (collision : Collision) {
var contact : ContactPoint = collision.contacts[0];
yield WaitForSeconds(0.05);
Destroy(gameObject);
}
function OnTriggerEnter(col : Collider) {
col.SendMessageUpwards("ApplyDamage", transform.rotation, SendMessageOptions.DontRequireReceiver);
}
function Start()
{
yield WaitForSeconds(0.7);
Destroy(gameObject);
}
the problem i am having is that when a player spawns/fires a bullet it is already colliding with their player controller, so the bullet will apply damage to whoever fired it.
How can i make by bullet not damage the first thing it hits, but instead damage the second thing?