“LlSitTarget”的版本间的差异

来自人工智能助力教育知识百科
跳转至: 导航搜索
(创建页面,内容为“{{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}} {{函数详情 |函数名 = Function: llSitTarget( vector offset, rotation rot ); |参数= 参…”)
 
Wzc讨论 | 贡献
 
第23行: 第23行:
 
}
 
}
 
</pre>
 
</pre>
 +
 +
<pre>
 
default    //example with work-around for llSetTarget rot bug
 
default    //example with work-around for llSetTarget rot bug
 
{          //place in any prim large enough to sit on at any angle
 
{          //place in any prim large enough to sit on at any angle
第45行: 第47行:
 
     }
 
     }
 
}
 
}
<pre>
+
 
 
</pre>
 
</pre>
 
|相关函数=
 
|相关函数=

2020年8月11日 (二) 01:23的最新版本

Template:Needs Translation/


函数名
Function: llSitTarget( vector offset, rotation rot );
参数:

•矢量偏移–sit目标在局部原始坐标系中的附加位置。 •旋转旋转–相对于主旋转,sit目标的附加旋转。 如果偏移==<0.0,0.0,0.0>则移除sit目标。

返回值:设置prim的坐姿位置。坐姿位置是相对于prim的位置和旋转。
注意事项
llSitTarget设置代理目标的位置(高级->字符->查看代理目标)。目标的位置基于rot和偏移。
示例
示例1
default
{
    state_entry()
    {
        llSitTarget(<0.0, 0.0, 1.0>, ZERO_ROTATION); //The vector's components must not all be set to 0 for effect to take place.
    }
}
default     //example with work-around for llSetTarget rot bug
{           //place in any prim large enough to sit on at any angle
            //click once to choose a place to sit, a second time to sit there
    touch_start(integer num)
    {
        vector pos=llDetectedTouchPos(0);       //use touch to set sit target
        vector lft=llDetectedTouchBinormal(0);  //use normals to rotate avatar to
        vector up=llDetectedTouchNormal(0);     //sit upright
        rotation rot=llAxes2Rot(lft%up,lft,up)/llGetRot();  //rotate avatar to stand there
        vector siz=llGetAgentSize(llDetectedKey(0));
        pos += 0.65*siz.z*up;       //this places MY avatars feet close to the surface
        pos = (pos-llGetPos())/llGetRot();  //llSetTarget expects local co-ordinates
        if (rot!=ZERO_ROTATION) pos -=<0,0,0.4>;  //here is the work around
        llSitTarget(pos,rot);
        llSetClickAction(CLICK_ACTION_SIT);   //switch to sit for second click
    }
    changed(integer change)
    {
        if (llAvatarOnSitTarget()==NULL_KEY)    //if they unsit,
            llSetClickAction(CLICK_ACTION_TOUCH);   //go back to click mode
    }
}

相关函数
llLinkSitTarget

llSetSitText

llAvatarOnSitTarget

llAvatarOnLinkSitTarget

llUnSit

相关事件
changed