Hello,
I have the following script attached to my missile launcher. If I need to adjust the angle of launching should I use script to change the actual angle of the launcher or would it be better/easier to just change the angle that the missile leaves the launcher? I want to have 3 different launch angles (low, mid, high) that the player can cycle through with the shift key.
Thank you,
Calvin
var projectile : Rigidbody;
var speedBall = 100;
var shotSound : AudioClip;
var font : Font;
static var canonCounter=0;
static var hitCounter=0;
function Update ()
{
if( Input.GetButtonDown( "Fire1") )
{
var instantiatedProjectile : Rigidbody = Instantiate( projectile, transform.position, transform.rotation );
instantiatedProjectile.velocity = transform.TransformDirection( Vector3( 0, 0, speedBall ) );
projectile.tag = "monarchProjectile";
audio.PlayOneShot(shotSound);
canonCounter=canonCounter+1;
print(canonCounter);
}
}
function OnGUI ()
{
GUI.skin.font = font;
GUI.Label(Rect (35,192,400,300), "Cannonballs - "+canonCounter);
GUI.Label(Rect (155,192,400,300), "Targets Hit - "+hitCounter+" of 18");
}