Creates a pathfinding entity, known as a "character", from the object containing the script. Required to activate use of pathfinding functions.

Syntax

void llCreateCharacter( list options );

Parameters

list options (instructions)
Character configuration options.

By default, the character's shape will be an upright capsule approximately the size of the linkset, adjustable via the options list. The linkset must use the land impact accounting system introduced with the mesh project. If called on an existing character, all unspecified parameters other than character size will revert to their defaults (if not specified, character size will not change). This is STRONGLY preferred over calling llDeleteCharacter() followed by llCreateCharacter() as it is much, much less taxing on the server.

Constants

OptionDefaultRange / ValuesDescription
CHARACTER_DESIRED_SPEED16speed (≥ 0.2, ≤ 40.0)Speed of pursuit in meters per second.
CHARACTER_RADIUS2radius (≥ 0.125, ≤ 5.0)Set collision capsule radius.
CHARACTER_LENGTH3length (> 0.0, ≤ 10.0)Set collision capsule length

If the value is less than twice the radius plus 0.1m, it will be set to twice the radius plus 0.1m.

CHARACTER_ORIENTATION4VERTICALVERTICAL, HORIZONTALSet the character orientation.
TRAVERSAL_TYPE7TRAVERSAL_TYPE_SLOWTRAVERSAL_TYPE_FAST, TRAVERSAL_TYPE_SLOW, TRAVERSAL_TYPE_NONEControls the speed at which characters moves on terrain that is less than 100% walkable will move faster (e.g., a cat crossing a street) or slower (e.g., a car driving in a swamp).

To use _FAST or _SLOW, you must specify a CHARACTER_TYPE.

CHARACTER_TYPE6CHARACTER_TYPE_NONECHARACTER_TYPE_A, CHARACTER_TYPE_B, CHARACTER_TYPE_C, CHARACTER_TYPE_D, CHARACTER_TYPE_NONESpecifies which walkability coefficient will be used by this character.
CHARACTER_AVOIDANCE_MODE5AVOID_CHARACTERS | AVOID_DYNAMIC_OBSTACLESCombinable Flags:

AVOID_CHARACTERS, AVOID_DYNAMIC_OBSTACLES, AVOID_NONE
Allows you to specify that a character should not try to avoid other characters, should not try to avoid dynamic obstacles (relatively fast moving objects and avatars), or both. This is framed in the positive sense ([CHARACTER_AVOIDANCE_MODE, AVOID_CHARACTERS] would create a character that avoided other characters but not agents or moving vehicles). Setting this parameter to AVOID_NONE causes the character to not avoid either category.
CHARACTER_MAX_ACCEL820acceleration (≥ 0.5, ≤ 40.0)The character's maximum acceleration rate.
CHARACTER_MAX_DECEL930deceleration (≥ 0.5, ≤ 60.0)The character's maximum deceleration rate.
CHARACTER_DESIRED_TURN_SPEED126speed (≥ 0.02, ≤ 40.0)The character's maximum speed while turning--note that this is only loosely enforced (i.e., a character may turn at higher speeds under certain conditions)
CHARACTER_MAX_TURN_RADIUS101.25radius (≥ 0.1, ≤ 10.0)The character's turn radius when traveling at CHARACTER_DESIRED_TURN_SPEED
CHARACTER_MAX_SPEED1320max_speed (≥ 1, ≤ 40.0)The character's maximum speed. Affects speed when avoiding dynamic obstacles and when traversing low-walkability objects in TRAVERSAL_TYPE_FAST mode.
CHARACTER_ACCOUNT_FOR_SKIPPED_FRAMES14TRUETRUE or FALSETRUE matches pre-existing behavior. If set to FALSE, character will not attempt to catch up on lost time when pathfinding performance is low, potentially providing more reliable movement (albeit while potentially appearing to be more stuttery).
CHARACTER_STAY_WITHIN_PARCEL15Depends*TRUE or FALSEFALSE matches traditional behavior. If set to TRUE, treat the parcel boundaries as one-way obstacles (will re-enter but can't leave on it's own).

Caveats

(subject to change)

Examples

create_character()
{
//  Clear any previous character behaviors
    llDeleteCharacter();

//  MAX_SPEED is @ 20 by default
    llCreateCharacter([ CHARACTER_MAX_SPEED, 25,
                        CHARACTER_DESIRED_SPEED, 15.0]);
}

patrol_around(vector targetPos)
{
    list points = [targetPos + <5, 0, 0>, targetPos - <5, 0, 0>];
    llPatrolPoints(points, []);
}

default
{
    on_rez(integer start_param)
    {
        llResetScript();
    }

    state_entry()
    {
        create_character();
    }
 
    touch_start(integer num_detected)
    {
        patrol_around(llGetPos());
    }
}

See also

Events

Functions

Deep notes

History

Date of Release 31/07/2012