Thursday, June 30, 2011

Unity FPS Shooter Game Tutorial #4

Adding explosions to missiles that have been launched =====















as a reminder the projectile script is as below:

var explosion : GameObject;


function OnCollisionEnter( collision : Collision )
{
var contact : ContactPoint = collision.contacts[0];
var rotation = Quaternion.FromToRotation( Vector3.up, contact.normal );
var instantiatedExplosion : GameObject = Instantiate(
explosion, contact.point, rotation );
Destroy( gameObject );
}


No comments:

Post a Comment