llDetectedTouchNormal
vector llDetectedTouchNormal(integer Index)Returns the surface normal for a triggered touch event.
Returns a vector that is the surface normal (perpendicular to the surface) where the touch event was triggered.
Parameters
-
Index(integer) - Index of detection information
The surface normal returned represents a vector perpendicular to the surface where the touch event was triggered. Along with llDetectedTouchBinormal, this information can be used to find the tangent space at the touch location. To find the third tangent vector, cross the binormal with this vector.
Caveats
Section titled “Caveats”TOUCH_INVALID_VECTOR(same as ZERO_VECTOR<0.0, 0.0, 0.0>) is returned when:- The avatar’s viewer does not support face touch detection (check
llDetectedTouchFaceto verify support) - The touch has moved off the surface of the prim
- The event triggered is not a touch event
- The avatar’s viewer does not support face touch detection (check
- The rotation of a legacy sphere prim does not influence touch normal like it does with other legacy prims
- For touch events only: the prim that was touched may not be the prim receiving the event. Use
llDetectedLinkNumberto check this, andllDetectedTouchFaceto determine which face was touched
Examples
Section titled “Examples”default { touch_start(integer total_num) { llOwnerSay((string)llDetectedTouchNormal(0)); // Says the vector where the touched face is pointing to. }}Rotate a prim so the touched position points upwards:
touch_start(integer total_number) { // rotates the prim, so the touched position points upwards llSetRot(llGetRot() * llRotBetween(llDetectedTouchNormal(0), <0, 0, 1>));}See Also
Section titled “See Also”- llDetectedLinkNumber
- llDetectedTouchFace
- llDetectedTouchST
- llDetectedTouchUV
- llDetectedTouchPos
- llDetectedTouchBinormal
touch_start- Event triggered when avatar starts touchingtouch- Event triggered during touchtouch_end- Event triggered when avatar stops touching