I’m new to Unity and trying to make a Worms type game in 2 or 2.5d. So far, I have my script for shooting working, but it only shoots at the set velocity. I need to figure out how to increase the power based on how long the shoot button is held down.
Any help would be greatly appreciated. Thanks!
My current shooting code:
var Shell:Rigidbody;
var mag:float = 10;
function Update ()
{
if(Input.GetButtonDown("Fire1"))
{
var newShell:Rigidbody;
newShell = Instantiate(Shell,transform.position,Quaternion.identity);
newShell.velocity = transform.TransformDirection(mag,0,0);
newShell.transform.Rotate(0,90,0);
}
}