# llDetectedTouchNormal

*LSL function*

```lsl
vector vector llDetectedTouchNormal(integer index);
```

- `integer index`: Index of the detection information.

- Returns: `vector`
- Energy: 10

For the [touch](/categories/touch/) category of events only. The prim that was touched may not be the prim receiving the event, use [llDetectedLinkNumber](/functions/llDetectedLinkNumber/) to check for this; likewise you can use [llDetectedTouchFace](/functions/llDetectedTouchFace/) to determine which face was touched.To find the third tangent vector, [cross](https://wiki.secondlife.com/wiki/LSL_Cross_Product) the [binormal](/functions/llDetectedTouchBinormal/) with this vector.

Returns a [vector](https://wiki.secondlife.com/wiki/vector) that is the surface normal (perpendicular to the surface) where the touch event was triggered. Along with [llDetectedTouchBinormal](/functions/llDetectedTouchBinormal/), this information can be used to find the [tangent space](http://en.wikipedia.org/wiki/Tangent_space) at the touch location.

```lsl title="How to use" frame="terminal"
vector result = llDetectedTouchNormal(0);
```

## Caveats

- [TOUCH_INVALID_VECTOR](/constants/TOUCH_INVALID_VECTOR/) is returned when...
- The avatar's viewer does not support face touch detection.
- To check if face touch detection is supported check the return of [llDetectedTouchFace](/functions/llDetectedTouchFace/).
- The touch has moved off the surface of the prim.
- The event triggered is not a [touch](/categories/touch/) event.
- The rotation of a legacy sphere prim does not influence touch normal like it does with other legacy prims.

## Examples

<details open>
<summary>Example 1</summary>

```lsl
default
{
    touch_start(integer total_num)
    {
        llOwnerSay((string)llDetectedTouchNormal(0)); //Says the vector where the touched face is pointing to.
    }
}
```

</details>

## Helper functions

```lsl
touch_start(integer total_number){
    // rotates the prim, so the touched position points upwards
    llSetRot(llGetRot()*llRotBetween(llDetectedTouchNormal(0),<0,0,1>));
}
```

## History

- Introduced in Viewer SVN:870 r92872 Branch:Release Wednesday, 23 July 2008, no server support, no viewer binary released.
- Server support available on preview grid in Second Life Beta Server 1.24, client support in Preview Grid viewer 1.20.15 (93532)
- Date of Release Server [29-08-2008](https://wiki.secondlife.com/wiki/Release_Notes/Second_Life_Beta_Server/1.24#release-notes-for-second-life-beta-server-1-24-3-28august-29th-2c-2008-29)
- Date of Release Client [16-10-2008](https://wiki.secondlife.com/wiki/Release_Notes/Second_Life_Release/1.21)

## See also

### Functions

- [llDetectedLinkNumber](/functions/llDetectedLinkNumber/)
- [llDetectedTouchFace](/functions/llDetectedTouchFace/)
- [llDetectedTouchST](/functions/llDetectedTouchST/)
- [llDetectedTouchUV](/functions/llDetectedTouchUV/)
- [llDetectedTouchPos](/functions/llDetectedTouchPos/)
- [llDetectedTouchBinormal](/functions/llDetectedTouchBinormal/)

### Events

- [touch_start](/events/touch_start/)
- [touch](/events/touch/)
- [touch_end](/events/touch_end/)

---

*Source: [LlDetectedTouchNormal](https://wiki.secondlife.com/wiki/LlDetectedTouchNormal) on the Second Life Wiki. Content from the Second Life Wiki articles LlDetectedTouchNormal (revision 1210375, 2021-12-01) and Template:LSL Function/detected (revision 1168823, 2012-06-11), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llDetectedTouchNormal/
