Difference between revisions of "LlDetectedTouchNormal"

From Second Life Wiki
Jump to navigation Jump to search
m (added date of release server)
m
(One intermediate revision by one other user not shown)
Line 5: Line 5:
|return_type=vector|return_text=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 [http://en.wikipedia.org/wiki/Tangent_space tangent space] at the touch location.
|return_type=vector|return_text=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 [http://en.wikipedia.org/wiki/Tangent_space tangent space] at the touch location.
|p1_type=integer|p1_name=index
|p1_type=integer|p1_name=index
|func_footnote=For the {{LSLGC|Touch|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.{{PBR}}To find the third tangent vector, [[LSL Cross Product|cross]] this vector with the [[llDetectedTouchBinormal|binormal]].
|func_footnote=For the {{LSLGC|Touch|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.{{PBR}}To find the third tangent vector, [[LSL Cross Product|cross]] the [[llDetectedTouchBinormal|binormal]] with this vector.
|func_desc
|func_desc
|spec
|spec
Line 14: Line 14:
** The touch has moved off the surface of the prim.
** The touch has moved off the surface of the prim.
** The event triggered is not a {{LSLGC|Touch|touch}} event.
** The event triggered is not a {{LSLGC|Touch|touch}} event.
|examples=<lsl>
|examples=<source lang="lsl2">
default
default
{
{
Line 22: Line 22:
     }
     }
}
}
</lsl>
</source>
|helpers=
|helpers=
<lsl>touch_start(integer total_number){
<source lang="lsl2">touch_start(integer total_number){
     // rotates the prim, so the touched position points upwards
     // rotates the prim, so the touched position points upwards
     llSetRot(llGetRot()*llRotBetween(llDetectedTouchNormal(0),<0,0,1>));
     llSetRot(llGetRot()*llRotBetween(llDetectedTouchNormal(0),<0,0,1>));
}</lsl>
}</source>
|related
|related
|also_functions=
|also_functions=

Revision as of 00:59, 22 January 2015

Summary

Function: vector llDetectedTouchNormal( integer index );

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.

• integer index Index of detection information

index does not support negative indexes. 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.

Caveats

  • If index is out of bounds the script continues to execute without an error message.
  • TOUCH_INVALID_VECTOR is returned when...
    • The avatar's viewer does not support face touch detection.
    • The touch has moved off the surface of the prim.
    • The event triggered is not a touch event.
All Issues ~ Search JIRA for related Bugs

Examples

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

Useful Snippets

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

See Also

Deep Notes

History

Search JIRA for related Issues

Signature

function vector llDetectedTouchNormal( integer index );