var Missile : Rigidbody;
var localOffput : Vector3 = new Vector3(200, 200, 200);
var SpawnPlace : Vector3 = new Vector3(0, 0, 0);
var startingSpeed : int = 30;
function Update () {
SpawnPlace = new Vector3(transform.position.x, transform.position.y, transform.position.z);
}
function Blast () {
Debug.Log("I'M FIIRIN MY MISSILWE!!!");
var newMissile : Rigidbody;
newMissile = Instantiate (Missile, Vector3(transform.position.x, transform.position.y, transform.position.z), gameObject.transform.rotation);
//PlayerSpeed = transform.Find("Capsule");
//newMissile.rigidbody.velocity = GameObject.Find("Wings").rigidbody.velocity;
//newMissile.angularVelocity = GameObject.Find("Wings").rigidbody.angularVelocity;
//newMissile.velocity += transform.TransformDirection(Vector3.forward * startingSpeed);
newMissile.rigidbody.AddForce(transform.forward * startingSpeed);
//newMissile.velocity += transform.TransformDirection(Vector3 (0, 0, startingSpeed));
//newMissile.velocity = new Vector3(300, 300, 300);
Physics.IgnoreCollision(newMissile.collider, transform.root.collider);
}
OK, I have no idea why my instantiated missile refuses to move, no matter what kind of code I put on it. In fact, it does not seem to at all be affected by anything I code after I instantiate it. What could cause such a behaviour? What have I forgot to do?