- Home /
Missile not launching(anymore)
im folowing the fps tutorial and ive just added the GUI (but even when i remove this there is still the same problem) that my Missile object isn't being fired is it a problem with my scrips? Here they are:
missileLauncher
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 ); } }
projectile
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 ); }
and finily Explosion
var explosionTime = 1.0; function Start() { Destroy( gameObject, explosionTime ); }
PLZ help me and if it isn't the code what else could it be?
BU$$anonymous$$P come on some one has to know how to fix this
Could you format and shove your code in code tags so we can read it...
Your answer
![](https://koobas.hobune.stream/wayback/20220613103554im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
What is AutoWayPoint 1 Answer
Team-based AI help 0 Answers
AI FPS tutorial collision problem 1 Answer
ufps package freezes when adding inventory system 0 Answers
Script not working at ALL 0 Answers