Difference between revisions of "LlFleeFrom"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with "{{Pathfinding alpha}} {{LSL_Function| func=llFleeFrom| func_desc=Directs an object to keep away from a defined position in the region or adjacent regions.| p1_type=vector| p1_nam…")
 
Line 49: Line 49:
notes= The position vector can be set outside the current region by using extended range region coordinates: e.g., to avoid the SE corner of the region to the East of the current one, you could llFleeFrom(<0.0, 512.0, 0.0>, []); |
notes= The position vector can be set outside the current region by using extended range region coordinates: e.g., to avoid the SE corner of the region to the East of the current one, you could llFleeFrom(<0.0, 512.0, 0.0>, []); |
also_functions=
also_functions=
* [[llCreateCharacter]]
* [[llDeleteCharacter]]
* [[llEvade]]
* [[llEvade]]
* [[llCreateCharacter]]
* [[llExecPathingCmd]]
* [[llGetClosestNavPoint]]
* [[llFleeFrom]]
* [[llNavigateTo]]
* [[llPatrolPoints]]
* [[llPursue]]
* [[llUpdateCharacter]]
* [[llWanderWithin]]|
also_events=
* [[path_update]]
}}
}}

Revision as of 13:53, 14 February 2012

Summary

Function: llFleeFrom( vector source, float distance, list options );

Directs an object to keep away from a defined position in the region or adjacent regions.

• vector source Global coordinate from which to flee.
• float distance Distance in meters to flee from the source.
• list options No options available at this time.

Caveats

  • Must use llCreateCharacter or script won't compile.
  • Vertical positions specified for any vectors should be chosen to be as close as possible to the actual height of the terrain requested. Large difference between the provided vertical position and the actual terrain/object will result in failure of the behavior.
  • 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.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl> vector last_touched_pos; key last_touched_key;

default { state_entry() {

}

touch_start(integer total_number) { last_touched_key = llDetectedKey(0); last_touched_pos = llList2Vector(llGetObjectDetails(last_touched_key, [OBJECT_POS]), 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(owner_pos, last_owner_pos) > 1 ) { last_touched_pos = last_touched_pos_now; llFleeFrom(last_touched_pos, 10, []); } } }

</lsl>

Notes

The position vector can be set outside the current region by using extended range region coordinates: e.g., to avoid the SE corner of the region to the East of the current one, you could llFleeFrom(<0.0, 512.0, 0.0>, []);

Deep Notes

Search JIRA for related Issues

Signature

function void llFleeFrom( vector source, float distance, list options );