I'm trying to get the player to shoot a projectile at the mouse position, however the projectile is shot in weird directions (http://gfycat.com/BothFluidHoneyeater).
Here is relevant part of my code:
var shotSpeed = 1000;
var projectile : Rigidbody;
function Update () {
var clone : Rigidbody;
if(Input.GetKeyDown(KeyCode.Mouse0)){
clone = Instantiate(projectile, transform.position, transform.rotation);
}
clone.rigidbody.AddForce(Vector3.forward * shotSpeed);
}
What am I doing wrong?