Hello,
I am currently using a script to fire a game object
var missile : GameObject;
function Update () {
if (Input.GetMouseButtonDown (0))
{
var position : Vector3 = new Vector3(0, -0.2, 1) * 10.0;
position = transform.TransformPoint (position);
var thisMissile : GameObject = Instantiate (missile, position, transform.rotation) as GameObject;
Physics.IgnoreCollision(thisMissile.collider, collider);
}
}
and this script for the trajectory
var explosion : GameObject;
function FixedUpdate () {
rigidbody.AddForce (transform.TransformDirection (Vector3.forward) * 200.0);
}
function OnCollisionEnter(collision : Collision) {
var contact : ContactPoint = collision.contacts[0];
Instantiate (explosion, contact.point + (contact.normal * 5.0) , Quaternion.identity);
if (collision.gameObject.tag == "enemy")
{
Destroy (collision.gameObject);
}
Destroy (gameObject);
}
However I attach the first code to a GUI texture and the second to a prefab which I am firing. The only problem is that the button does not fire at all. If anyone could help me that would be great as I know nothing of code.