LlNavigateTo

来自人工智能助力教育知识百科
跳转至: 导航搜索

Template:Needs Translation/


函数名
Function: llNavigateTo( vector pos, list options );
参数:

• vector pos – position in region coordinates for the character to navigate to.

• list options – List of parameters to control the type of pathfinding used.

返回值:

将物体导向该区域或邻近区域中的一个确定的位置。

注意事项
注意事项
  • 必须首先使用 llcreatecharacter,否则该函数将失败与查看器错误。
  • 为任何向量指定的垂直位置应尽可能接近所要求的表面的实际高度。提供的垂直位置与实际地形/物体之间的大差异将导致行为的失败。
  • 如果你想像下面这个例子一样追踪一个代理或者对象,那么使用 llpurchase 会更优雅,而且缩减 sim 资源密集度。
示例
示例一
vector last_touched_pos;
key last_touched_key;
 
default
{
    state_entry()
    {
        llCreateCharacter([CHARACTER_DESIRED_SPEED, 50.0]);
    }
 
    touch_start(integer total_number)
    {
        last_touched_key = llDetectedKey(0);
        last_touched_pos = llList2Vector(llGetObjectDetails(last_touched_key, [OBJECT_POS]), 0);
        llNavigateTo(last_touched_pos, []);
        llSetTimerEvent(0.2);
    }
 
    timer()
    {
        vector last_touched_pos_now = llList2Vector(llGetObjectDetails(last_touched_key, [OBJECT_POS]), 0);
        if ( llVecDist(last_touched_pos_now, last_touched_pos) > 1 )
        {
            last_touched_pos = last_touched_pos_now;
            llNavigateTo(last_touched_pos, []);
        }
    }
}
相关函数
llCreateCharacter

llDeleteCharacter

llEvade

llExecCharacterCmd

llGetClosestNavPoint

llFleeFrom

llNavigateTo

llPatrolPoints

llPursue

llUpdateCharacter

llWanderWithin

相关事件
path update