I need help on my FPS again, my missile wont launch. I made the Launcher and added the Script to it,
var projectile : Rigidbody;
var speed = 20;
function Update () {
}
if( Input.GetButtonDown( "Fire1" ) )
{
var instantiatedProjectile : Rigidbody = Instantiate(
projectile, transform.position, transform.rotation );
instantiatedProjectile.velocity =
transform.TransformDirection( Vector3( 0, 0, speed ) );
Physics.IgnoreCollision( instantiatedProjectile. collider,
transform.root.collider );
}
Then I made the Missile for the Launcher and added the Explosion script to it,
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 );
}
Then I go to test what I have done. I think I’m supposed to left click to fire, so I do that and nothing happens.
Am I doing something wrong?