Skip to content
lsl.devlsl.devLSL Dev

llDetectedTouchNormal

function
Function syntax
vector llDetectedTouchNormal(
  1. integer index// Index of the detection information.
);
Returns
vector
Energy
10

For the touch category of events only. The prim that was touched may not be the prim receiving the event, use llDetectedLinkNumber to check for this; likewise you can use llDetectedTouchFace to determine which face was touched.To find the third tangent vector, cross the binormal with this vector.

Returns a vector that is the surface normal (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.

How to use
vector result = llDetectedTouchNormal(0);
  • 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.
  • The touch has moved off the surface of the prim.
  • The event triggered is not a touch event.
  • The rotation of a legacy sphere prim does not influence touch normal like it does with other legacy prims.
Example 1
default
{
touch_start(integer total_num)
{
llOwnerSay((string)llDetectedTouchNormal(0)); //Says the vector where the touched face is pointing to.
}
}
touch_start(integer total_number){
// rotates the prim, so the touched position points upwards
llSetRot(llGetRot()*llRotBetween(llDetectedTouchNormal(0),<0,0,1>));
}
  • 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
  • Date of Release Client 16-10-2008
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.