“LlDetectedTouchFace”的版本间的差异
 (创建页面,内容为“{{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}}   {{函数详情 |函数名 = Function: integer llDetectedTouchFace( integer index ); |参数= 参…”)  | 
				|||
| (未显示同一用户的1个中间版本) | |||
| 第4行: | 第4行: | ||
{{函数详情  | {{函数详情  | ||
|函数名 = Function: integer llDetectedTouchFace( integer index );  | |函数名 = Function: integer llDetectedTouchFace( integer index );  | ||
| − | |参数=   | + | |参数= 参数:整数索引—检测信息索引不支持负索引。  | 
| − | |返回值=   | + | |返回值= 返回值:返回一个整数,该整数是所单击的头像的索引。  | 
|注意事项=  | |注意事项=  | ||
| − | *  | + | 注意事项  | 
| − | *  | + | *如果索引超出界限,脚本将继续执行,不会出现错误消息。  | 
| − | **  | + | *当…时返回TOUCH_INVALID_FACE  | 
| − | **  | + | **头像查看器不支持面部触摸检测。  | 
| − | **  | + | **触摸已经离开了表面的prim。  | 
| + | **触发的事件不是触摸事件。  | ||
|示例=  | |示例=  | ||
2020年5月18日 (一) 11:17的最新版本
| 首页 | 函数 | 事件 | 类型 | 操作符 | 常数 | Flow Control | Script Library | Categorized Library | Tutorials | 
| 函数名 | 
|---|
| Function: integer llDetectedTouchFace( integer index ); | 
| 参数:整数索引—检测信息索引不支持负索引。 | 
| 返回值:返回一个整数,该整数是所单击的头像的索引。 | 
| 注意事项 | 
|---|
注意事项
  | 
| 示例 | 
|---|
示例1
// This is the essential script to drop in a prim when you need to ascertain the number of a face (or faces)
// Touch the prim surfaces to learn their face numbers, which you can then use in other scripts for texturing, colouring etc.
 
say(string message)
{
    llSay(PUBLIC_CHANNEL, message);
}
 
default
{
    touch_start(integer num_detected)
    {
        integer face = llDetectedTouchFace(0);
 
        if (face == TOUCH_INVALID_FACE)
//      {
            say("The touched face could not be determined");
//      }
        else
//      {
            say("You touched face number " + (string) face);
//      }
    }
}
示例2 default
{
    touch_start(integer num_detected)
    {
        integer link = llDetectedLinkNumber(0);
        integer face = llDetectedTouchFace(0);
 
        if (face == TOUCH_INVALID_FACE)
            llSay(PUBLIC_CHANNEL, "Sorry, your viewer doesn't support touched faces.");
        else
        {
            // store the original color
            list   colorParams   = llGetLinkPrimitiveParams(link, [PRIM_COLOR, face]);
            vector originalColor = llList2Vector(colorParams, 0);
 
            // color detected face white
            llSetLinkColor(link, <1.0, 1.0, 1.0>, face);
            llSleep(0.2);
 
            // color detected face black
            llSetLinkColor(link, ZERO_VECTOR, face);
            llSleep(0.2);
 
            // color detected face back to original color
            llSetLinkColor(link, originalColor, face);
        }
    }
}
 | 
| 相关函数 | 
|---|
| llDetectedLinkNumber
 llDetectedTouchST llDetectedTouchUV llDetectedTouchPos llDetectedTouchNormal llDetectedTouchBinormal  | 
| 相关事件 | 
|---|
| touch_start |