Difference between revisions of "LlPursue"

From Second Life Wiki
Jump to navigation Jump to search
m (Change category from Pathfinding to LSL_Pathfinding)
(deprecated template)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Pathfinding LSL alpha}}
{{LSL_Function
{{LSL_Function
|inject-2={{LSL Function/uuid|target|object=*}}
|inject-2={{LSL Function/uuid|target|object=*}}
Line 9: Line 8:
|p2_type=list
|p2_type=list
|p2_name=options
|p2_name=options
|p2_subtype=instructions
|p2_desc=Parameters for pursuit; see below.
|p2_desc=Parameters for pursuit; see below.
|constants={{LSL_Constants/Pursue}}
|constants={{LSL_Constants/Pursue}}
Line 18: Line 18:
* FUZZ_FACTOR picks a point within an area of approximately (scale * lengthOfOffset) around the offset position. Value must be between 0.0 and 1.0.
* FUZZ_FACTOR picks a point within an area of approximately (scale * lengthOfOffset) around the offset position. Value must be between 0.0 and 1.0.
|examples=
|examples=
<lsl>
<source lang="lsl2">
default
default
{
{
Line 31: Line 31:
     }
     }
}
}
</lsl>  
</source>  
|also_functions=
|also_functions=
* [[llCreateCharacter]]
* [[llCreateCharacter]]
Line 47: Line 47:
* [[path_update]]
* [[path_update]]
|history = Date of Release  [[ Release_Notes/Second_Life_Server/12#12.07.31.262785 | 31/07/2012 ]]
|history = Date of Release  [[ Release_Notes/Second_Life_Server/12#12.07.31.262785 | 31/07/2012 ]]
|cat1=Pathfinding
}}
}}

Latest revision as of 15:51, 28 October 2023

Summary

Function: llPursue( key target, list options );

Causes the object to pursue target.

• key target group, avatar or object UUID to pursue.
• list options Parameters for pursuit; see below.

Option Value Description Usage Default Value
PURSUIT_OFFSET 1 Go to a position offset from the target.
[PURSUIT_OFFSET, vector offset]
ZERO_VECTOR
REQUIRE_LINE_OF_SIGHT 2 Define whether the character needs a physical line-of-sight to give chase. When enabled, the character will not pick a new target position while there is a something solid between the character and the target object/agent.
[REQUIRE_LINE_OF_SIGHT, integer boolean]
FALSE
PURSUIT_FUZZ_FACTOR 3 Selects a random destination near the PURSUIT_OFFSET. The valid fuzz factor range is from 0 to 1, where 1 is most random. This option requires a nonzero PURSUIT_OFFSET.
[PURSUIT_FUZZ_FACTOR, float factor]
0.0
PURSUIT_INTERCEPT 4 Define whether the character attempts to predict the target's future location.
[PURSUIT_INTERCEPT, integer boolean]
FALSE
PURSUIT_GOAL_TOLERANCE 5 Defines approximately how close the character must be to the current goal to consider itself to be at the desired position. The valid range is from 0.25 to 10m.
[PURSUIT_GOAL_TOLERANCE, float tolerance]
Default is proportional to character size

Caveats

  • Must use llCreateCharacter or script crash (script error)
  • 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 behaviour.
  • Z value is unused (erroneous if not 0.0) in parameter for PURSUIT_OFFSET.
  • REQUIRE_LINE_OF_SIGHT does not require line of sight immediately after llPursue() is called - it only affects target position updates after the target object/agent moves.
  • FUZZ_FACTOR picks a point within an area of approximately (scale * lengthOfOffset) around the offset position. Value must be between 0.0 and 1.0.

Examples

default
{
    state_entry()
    {
        llCreateCharacter([CHARACTER_DESIRED_SPEED, 35.0, CHARACTER_MAX_SPEED, 35.0]);
    }

    touch_start(integer total_number)
    {
        llPursue(llDetectedKey(0), [PURSUIT_OFFSET, <-2.0, 0.0, 0.0>, PURSUIT_FUZZ_FACTOR, 0.2]);
    }
}

Deep Notes

History

Date of Release 31/07/2012

Signature

function void llPursue( key target, list options );