Difference between revisions of "LlDetectedTouchNormal"

From Second Life Wiki
Jump to navigation Jump to search
m
m
Line 1: Line 1:
{{LSL_Function
{{LSL_Function
|inject-2={{LSL_Function/detected|index|TouchNormal|simple=*}}
|inject-2={{LSL_Function/detected|index|touchNormal|simple=*}}
|func_id=340|func_sleep=0.0|func_energy=10.0
|func_id=340|func_sleep=0.0|func_energy=10.0
|func=llDetectedTouchNormal
|func=llDetectedTouchNormal

Revision as of 21:27, 30 June 2012

Summary

Function: vector llDetectedTouchNormal( integer index );
0.0 Forced Delay
10.0 Energy

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 this vector with the binormal.

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.

Examples

<lsl> default {

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

}

</lsl>

Useful Snippets

<lsl>touch_start(integer total_number){

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

}</lsl>

See Also

Deep Notes

History

Signature

function vector llDetectedTouchNormal( integer index );