LlFleeFrom

来自人工智能助力教育知识百科
Mkx讨论 | 贡献2020年4月13日 (一) 12:59的版本 (创建页面,内容为“{{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}} {{函数详情 |函数名 = Function: llFleeFrom( vector position, float distance, list options…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索

Template:Needs Translation/


函数名
Function: llFleeFrom( vector position, float distance, list options );
参数: vector position – position in region coordinates from which to flee.

float distance – Distance in meters to flee from position.

list options – No options available at this time.

返回值:Directs a character to keep a specific distance from a specific position in the region or adjacent regions.
注意事项
Must use llCreateCharacter or script won't compile.

The position to flee from must be near the nav mesh; otherwise, this behavior will fail and trigger path update with PU_FAILURE_INVALID_GOAL.

If you want to avoid an agent or object as per the example below, it's much more elegant and less sim resource intensive to use llEvade instead.

示例
示例1
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 = llDetectedPos(0);
	llFleeFrom(last_touched_pos, 10, []);
	llSetTimerEvent(0.2);
    }
 
    timer()
    {
	vector last_touched_pos_now = llList2Vector(llGetObjectDetails(last_touched_key, [OBJECT_POS]), 0);
	if ( llVecDist(last_touched_pos, last_touched_pos_now) > 1 )
	{
	    last_touched_pos = last_touched_pos_now;
	    llFleeFrom(last_touched_pos, 10, []);
	}
    }
}
相关函数
llCreateCharacter

llDeleteCharacter

llEvade

llExecCharacterCmd

llGetClosestNavPoint

llFleeFrom

llNavigateTo

llPatrolPoints

llPursue

llUpdateCharacter

llWanderWithin

相关事件
path_update