jump gravity script

What can i add to this script so it can jump and have gravity?

//Drag the Spawned Object Enemy across 3D plane====== 


//var enemyselect : Transform; (NB: I used to have this in there until i realised it had no effect. In the inspector on the prefab object i would choose the prefab itself - but i need a way for the touch to register ONLY on each spawned object individually.) 

var hit : RaycastHit; 

function Update () { 
   var ray = Camera.main.ScreenPointToRay (Input.mousePosition); 
   for (touch in iPhoneInput.touches) { 
      if (Physics.Raycast (ray, hit, 100)  (hit.transform == transform)) { 

         if (iPhoneInput.touchCount > 0  iPhoneInput.GetTouch(0).phase == iPhoneTouchPhase.Moved) { 
       
            transform.position = Camera.main.ScreenToWorldPoint(new Vector3 (touch.position.x,touch.position.y,10)); 
         } 
       
      } 
   } 
}

[/quote]

You just want it to jump up when somebody hits a button?

Does the object use a rigidbody?

I would like the player to jump up when the player and the player only is touched on the screen and yes it does have a rigid body.

Assuming the rigidbody has gravity enabled, you can make it jump using the AddForce function:-

rigidbody.AddForce(Vector3.up * jumpStrength);

The jumpStrength value will depend on the mass of the object and how high you want it to go. Also, you might want to move this code into the FixedUpdate function, although it probably won’t make that much difference with a force added on a single frame like this.