I want to hit my homing missile exactly enemy’s center place and want to collider it as it hit enemy’s skin.
I use function of OnCollisionEnter, like this,
function OnCollisionEnter(hit : Collision) // When the bullet hits something
{
if (hit.transform.tag == "enemy") { // If it's the enemy
hit.gameObject.SendMessage("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); // Hurt it
Instantiate(deathParticles, transform.position, transform.rotation); // Create death particles
Destroy(this.gameObject);
}
}
But problem is, if enemy is some complicated prefab and has many spines and joints, there is many factor in just 1 character like fbx file.
Anyway, if I set that enemy character’s Tag as [enemy], missile goes to enemy’s foot’s center location, not body’s center. And missile does some rotate action at there and then destroyed itself.
This seems ridiculous and don’t know why.