Here is the projectile script I am attempting to use. Please bare with me I am extremely new to programming and Unity.
var projectile : Rigidbody;
var damage = 5;
function update () {
if(Input.GetButtonDown("Fire1")){
Spawnpoint = transform.Find("/First Person Controller/Main Camera/Spawnpoint");
SpawnVector = Vector3(Spawnpoint.position.x, Spawnpoint.position.y, Spawnpoint.position.z);
var clone: Rigidbody;
clone = Instantiate(projectile, SpawnVector, Spawnpoint.rotation);
clone.velocity = Spawnpoint.TransformDirection (SpawnVector.forward*20);
}
}
There are a few issues I’m having.
But the main issue I’m having is that my projectile does not fire at all when I ‘left click’. Is there somewhere else I need to define “Fire1” - I was under the impression that it was built into the First Person Controller.
Any insight into my problem would be much appreciated. As I said. I am very new and I attempted to look up a solution to this issue but only found other working and much more complicated scripts. I’d really prefer to learn on my own and I hope I didn’t inconvenience anyone by posting here.
Thank you in advance for your time!