I am shooting A ball using a prefab.
I have it set up so that when I press the Fire1 Key A animation plays, and in this script I made it plays at the same time as the animation, and I want the ball to shoot after the animation, so I tried to delay it using yield WaitForSeconds, but when I did that the script doesn’t make the prefab any more any and so nothing happens, except the animation.
I’m pretty new to Scripting. any help is appreciated.
var projectile : Rigidbody;
var speed = 20;
function FixedUpdate()
{
if(Input.GetButtonDown ("Fire1"))
yield WaitForSeconds(5);
clone = Instantiate(projectile, transform.position, transform.rotation);
clone.velocity = transform.TransformDirection(Vector3(0,0,speed));
}