“LlLookAt”的版本间的差异
(创建页面,内容为“{{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}} {{函数详情 |函数名 = Function: llLookAt( vector target, float strength, float damping );…”) |
|||
| 第13行: | 第13行: | ||
使物体将其上轴(正 z)指向目标,同时将其前轴(正 x)保持在水平线以下。继续跟踪目标,直到调用 llstoplookat。 | 使物体将其上轴(正 z)指向目标,同时将其前轴(正 x)保持在水平线以下。继续跟踪目标,直到调用 llstoplookat。 | ||
|注意事项= | |注意事项= | ||
| + | 注意事项 | ||
*不能保证宿主对象最终会指向目标。根据物体的形状、强度和阻尼,如果阻尼在最终位置到达之前停止旋转,它很可能在不同的旋转方向上停止。 | *不能保证宿主对象最终会指向目标。根据物体的形状、强度和阻尼,如果阻尼在最终位置到达之前停止旋转,它很可能在不同的旋转方向上停止。 | ||
*如果 prim 不是根,那么目标物将需要根 prim 旋转的校正(见下面的例子)。 | *如果 prim 不是根,那么目标物将需要根 prim 旋转的校正(见下面的例子)。 | ||
2020年8月22日 (六) 03:38的最新版本
| 首页 | 函数 | 事件 | 类型 | 操作符 | 常数 | Flow Control | Script Library | Categorized Library | Tutorials |
| 函数名 |
|---|
| Function: llLookAt( vector target, float strength, float damping ); |
| 参数:
• vector target – position in region coordinates • float strength • float damping – seconds to critically damp in |
| 返回值:
使物体将其上轴(正 z)指向目标,同时将其前轴(正 x)保持在水平线以下。继续跟踪目标,直到调用 llstoplookat。 |
| 注意事项 |
|---|
注意事项
|
| 示例 |
|---|
示例一
//Causes Object to look at nearest Avatar.
default
{
state_entry()
{
llSensorRepeat("", "", AGENT, 20.0, PI, 0.2);
}
sensor(integer total_number)
{
llLookAt( llDetectedPos(0) + <0.0, 0.0, 1.0>, 3.0, 1.0 );
}
}
示例二 // Same as above, but for use inside a child prim or the root of an attachment.
// Make the child or attachment look at nearest Avatar.
default
{
state_entry()
{
llSensorRepeat("", "", AGENT, 20.0, PI, 0.2);
}
sensor(integer total_number)
{
vector p = llGetPos();
llLookAt(p + (llDetectedPos(0) + <0.0, 0.0, 1.0> - p) / llGetRootRotation(), 3.0, 1.0);
}
}
|
| 相关函数 |
|---|
| llRotLookAt |
| 相关事件 |
|---|