Hi this may sound like a very dumb question but I am trying to get the explosion to be made at the player location but only when the health reaches 0, here isi the script.
var explosion : GameObject;
var playerHealth = 100;
var damage = 10;
function OnCollisionEnter(collision : Collision)
{
var contact : ContactPoint = collision.contacts[0];
var rotation = Quaternion.FromToRotation(Vector3.up, contact.normal);
var playerDead = Instantiate (explosion, contact.point, rotation);
if(collision.gameObject.tag=="objectA" || collision.gameObject.tag=="objectB" || collision.gameObject.tag=="objectC")
{
playerHealth -= damage;
}
}
function Update()
{
if(playerHealth <= 0)
{
//want to call the playerDead variable here if possible
Destroy(gameObject);
}
}
Thank you