# strange launch code

**URL:** https://discussions.unity.com/t/strange-launch-code/423451
**Category:** Input
**Tags:** Scripting
**Created:** [September 20, 2010, 1:16pm UTC](https://discussions.unity.com/t/strange-launch-code/423451 "2010-09-20T13:16:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![chubbspet](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/chubbspet/32/427261_2.png) [@chubbspet](https://discussions.unity.com/u/chubbspet)
#### Post date: [September 20, 2010, 1:16pm UTC](https://discussions.unity.com/t/strange-launch-code/423451/1 "2010-09-20T13:16:22Z")

</div>

Hi there guys

For some reason my launch animation only triggers when I press the “w” kay TOGETHER with the “c” key. I want it to trigger only when I press the “c” key. Can someone please help! Thanks

```auto
if (Input.GetAxis ("Vertical"))
		{
		
		transform.Translate(Vector3(0,0,speed) * Time.deltaTime);
		
		}else{
	animation.CrossFade ("idle");
		}
		
	if (Input.GetAxis("Horizontal"))
	{
		myTarget.rotation.y += Input.GetAxis("Horizontal") * Time.deltaTime * 2;
	}

	if (Input.GetKeyDown("c"))
	{
		animation.CrossFade ("launch");
		isThrust = "true";
		constantForce.force = Vector3(0,5000,0);
	}

	if (Input.GetKeyUp("c"))
	{
		isThrust = "false";
		constantForce.force = Vector3.up * 0;
	}

```

---

<div class="post-metadata">

### Author: ![Vicenti](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/vicenti/32/369474_2.png) [@Vicenti](https://discussions.unity.com/u/Vicenti)
#### Post date: [September 20, 2010, 3:07pm UTC](https://discussions.unity.com/t/strange-launch-code/423451/2 "2010-09-20T15:07:32Z")

</div>

You’re crossfading Idle in if there’s no vertical input. Don’t crossfade Idle in if you’re launching, or set the launch animation layer higher than the Idle animation layer.

---

<div class="post-metadata">

### Author: ![chubbspet](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/chubbspet/32/427261_2.png) [@chubbspet](https://discussions.unity.com/u/chubbspet)
#### Post date: [September 20, 2010, 5:51pm UTC](https://discussions.unity.com/t/strange-launch-code/423451/3 "2010-09-20T17:51:40Z")

</div>

Thanks Vicenti

I kinda understand, can you maybe give me a simple example?

Thanks

---

<div class="post-metadata">

### Author: ![andeeeee](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@andeeeee](https://discussions.unity.com/u/andeeeee)
#### Post date: [September 22, 2010, 3:05pm UTC](https://discussions.unity.com/t/strange-launch-code/423451/4 "2010-09-22T15:05:38Z")

</div>

Is the code you’ve posted exactly the same as the code in your project? If you have the “if (Input.GetKeyDown(“c”))” statement inside the “if (Input.GetAxis (“Vertical”))” block, then this would work only when you press W, S or the up/down arrow keys.
