# iPhone touch raycasting

**URL:** https://discussions.unity.com/t/iphone-touch-raycasting/44748
**Category:** Questions & Answers
**Created:** [June 19, 2012, 8:26pm UTC](https://discussions.unity.com/t/iphone-touch-raycasting/44748 "2012-06-19T20:26:37Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![KaiserDE](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@KaiserDE](https://discussions.unity.com/u/KaiserDE)
#### Post date: [June 19, 2012, 8:26pm UTC](https://discussions.unity.com/t/iphone-touch-raycasting/44748/1 "2012-06-19T20:26:37Z")

</div>

I need help using raycast for unity iPhone. I have a game which contains a ball and a plane. The ball starts midair and gravity pushes it down. If it touches the plane, the game ends. I need help creating a script so when the player taps the ball, it bounces up. I already have the script to AddForce and make the ball bounce up, but I don’t know how to create the code that activates the addforce when I tap the ball.

---

<div class="post-metadata">

### Author: ![Tim-Michels](https://avatars.discourse-cdn.com/v4/letter/t/ecae2f/32.png) [@Tim-Michels](https://discussions.unity.com/u/Tim-Michels)
#### Post date: [June 20, 2012, 10:19am UTC](https://discussions.unity.com/t/iphone-touch-raycasting/44748/2 "2012-06-20T10:19:50Z")

</div>

_ **Sample** _

Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(i).position);

RaycastHit hitInfo;

if (Physics.Raycast(ray, out hitInfo, 1000, 0))

{

```
  //Use hitInfo to know which object was hit...

```

}

This should help you, I use this to check if I tapped 3D objects.

Cheers
