Difference between revisions of "LlDetectedTouchNormal"

From Second Life Wiki
Jump to navigation Jump to search
m
(maybe useful for someone)
Line 14: Line 14:
** The event triggered is not a {{LSLGC|Touch|touch}} event.
** The event triggered is not a {{LSLGC|Touch|touch}} event.
|examples
|examples
|helpers
|helpers=
<lsl>touch_start(integer total_number){
    // rotates the prim, so the touched position points upwards
    llSetRot(llGetRot()*llRotBetween(llDetectedTouchNormal(0),<0,0,1>));
}</lsl>
|related
|related
|also_functions=
|also_functions=

Revision as of 11:11, 18 February 2010

Summary

Function: vector llDetectedTouchNormal( integer index );

Returns a vector that is the surface normal (perpendicular to the surface) where the touch event was triggered.

• 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.

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

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

Search JIRA for related Issues

Signature

function vector llDetectedTouchNormal( integer index );