Difference between revisions of "LlDetectedTouchNormal"

From Second Life Wiki
Jump to navigation Jump to search
(maybe useful for someone)
(Add mention to tangent spaces)
Line 2: Line 2:
|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
|return_type=vector|return_text=that is the surface normal (perpendicular to the surface) where the touch event was triggered.
|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.
|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.
Line 8: Line 8:
|spec
|spec
|caveats=
|caveats=
*{{LSL Const|TOUCH_INVALID_VECTOR|vecter|{{LSL_VR|0.0|0.0|0.0}}|c=same as ZERO_VECTOR}} is returned when...
*{{LSL Const|TOUCH_INVALID_VECTOR|vector|{{LSL_VR|0.0|0.0|0.0}}|c=same as ZERO_VECTOR}} is returned when...
** The avatar's viewer does not support face touch detection.
** The avatar's viewer does not support face touch detection.
*** To check if face touch detection is supported check the return of [[llDetectedTouchFace]].
*** To check if face touch detection is supported check the return of [[llDetectedTouchFace]].

Revision as of 16:18, 4 March 2010

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.

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

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 );