# Lobbing

**URL:** https://discussions.unity.com/t/lobbing/414795
**Category:** Scripting
**Tags:** Scripting
**Created:** [May 28, 2010, 11:36pm UTC](https://discussions.unity.com/t/lobbing/414795 "2010-05-28T23:36:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Sydious](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/sydious/32/462141_2.png) [@Sydious](https://discussions.unity.com/u/Sydious)
#### Post date: [May 28, 2010, 11:36pm UTC](https://discussions.unity.com/t/lobbing/414795/1 "2010-05-28T23:36:16Z")

</div>

I am using the following script to “shoot” a bullet.

```auto
var shotsound:AudioClip;
var shellPrefab : GameObject;
var proyectilevelocity:int;
var ammo:int;
var fireRate = 1.0;
private var nextfire = 0.0;
function FixedUpdate () {
	if(Input.GetButton("Jump") Time.time>nextfire ammo>0)
		ShotProyectile();
}
function ShotProyectile(){
		if(Time.time > nextfire)
		{
	var Grenade:GameObject = Instantiate(shellPrefab,transform.position,transform.rotation);
	Grenade.GetComponentInChildren(Rigidbody).velocity =transform.TransformDirection(Vector3(0,0,proyectilevelocity));
	ammo--;
	if(shotsound)
		audio.PlayOneShot(shotsound);
	Destroy(Grenade,10);
	nextfire = Time.time+fireRate;}
}

```

This shoots the bullet straight out. How do I change the script to send the bullet out like a 45 deg angle up so it lobs the bullet? I assume transform.rotation needs to change but I don’t know what I need to do.

Can anyone help?

---

<div class="post-metadata">

### Author: ![Vimalakirti](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/vimalakirti/32/298975_2.png) [@Vimalakirti](https://discussions.unity.com/u/Vimalakirti)
#### Post date: [May 30, 2010, 4:28am UTC](https://discussions.unity.com/t/lobbing/414795/2 "2010-05-30T04:28:05Z")

</div>

I think I would start changing the second variable in this line:

```auto
   Grenade.GetComponentInChildren(Rigidbody).velocity =transform.TransformDirection(Vector3(0,0,proyectilevelocity));

```

The Vector3 (x,y,z) is a direction. Forward is (0,0,1) and up is (0,1,0) so to make it start to move upwards, try (0, 0.5, proyectilevelocity).

Let me know if that works.

---

<div class="post-metadata">

### Author: ![Vimalakirti](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/vimalakirti/32/298975_2.png) [@Vimalakirti](https://discussions.unity.com/u/Vimalakirti)
#### Post date: [May 30, 2010, 4:29am UTC](https://discussions.unity.com/t/lobbing/414795/3 "2010-05-30T04:29:58Z")

</div>

And would a moderator delete the account of that Wow spammer two0426?!

Also, Sydious, look at this page:

> **[Unity - Scripting API: Vector3](https://docs.unity3d.com/ScriptReference/Vector3.html)**
