# llNavigateTo

*LSL function*

```lsl
void llNavigateTo(vector pos, list options);
```

- `vector pos`: Destination position vector in region coordinates.
- `list options`: A list of parameters to configure pathfinding behavior (currently only FORCE_DIRECT_PATH is supported).

- Energy: 10

Directs an object to travel to a defined position in the region or adjacent regions.

Adjacent regions can be reached by extending the position vector into the nearby region.

```lsl title="How to use" frame="terminal"
llNavigateTo(ZERO_VECTOR, []);
```

## Specification

Constant group [CharacterNavigateParam](/constants/groups/CharacterNavigateParam/):

```lsl
FORCE_DIRECT_PATH = 1
```

| Constant | Type | Value | Description |
| --- | --- | --- | --- |
| [FORCE_DIRECT_PATH](/constants/FORCE_DIRECT_PATH/) | integer | `1` | Makes character navigate in a straight line toward pos. |

<table>
	<tr>
		<th>Option</th>
		<th>Value</th>
		<th>Parameters</th>
		<th>Default</th>
		<th>Description</th>
	</tr>
	<tr>
		<td>\[ [integer](https://wiki.secondlife.com/wiki/integer) **boolean** \]</td>
		<td>\[ [FALSE](/constants/FALSE/) \]</td>
		<td>Makes character navigate in a straight line toward **pos**. May be set to [TRUE](/constants/TRUE/) or [FALSE](/constants/FALSE/).</td>
	</tr>
</table>

## Caveats

- Must use [llCreateCharacter](/functions/llCreateCharacter/) first or the function will fail with a viewer error.
- Vertical positions specified for any vectors should be chosen to be as close as possible to the actual height of the surface requested. Large difference between the provided vertical position and the actual terrain/object will result in failure of the behavior.
- If you want to chase an agent or object as per the example below, it's much more elegant and less sim resource intensive to use [llPursue](/functions/llPursue/) instead.

## Examples

<details open>
<summary>Example 1</summary>

```lsl collapse={1-12, 18-22}
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, []);
        }
    }
}
```

</details>

## Notes

- [FORCE_DIRECT_PATH](/constants/FORCE_DIRECT_PATH/) can be used to rescue characters that have somehow fallen off the navigable zone as it doesn't use the navmesh.

(Needs verification.)

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

## History

Date of Release [31/07/2012](https://wiki.secondlife.com/wiki/Release_Notes/Second_Life_Server/12#12-07-31-262785)

## See also

### Functions

- [llCreateCharacter](/functions/llCreateCharacter/)
- [llDeleteCharacter](/functions/llDeleteCharacter/)
- [llEvade](/functions/llEvade/)
- [llExecCharacterCmd](/functions/llExecCharacterCmd/)
- [llGetClosestNavPoint](/functions/llGetClosestNavPoint/)
- [llFleeFrom](/functions/llFleeFrom/)
- [llNavigateTo](/functions/llNavigateTo/)
- [llPatrolPoints](/functions/llPatrolPoints/)
- [llPursue](/functions/llPursue/)
- [llUpdateCharacter](/functions/llUpdateCharacter/)
- [llWanderWithin](/functions/llWanderWithin/)

### Events

- [path_update](/events/path_update/)

---

*Source: [LlNavigateTo](https://wiki.secondlife.com/wiki/LlNavigateTo) on the Second Life Wiki. Content from the Second Life Wiki articles LlNavigateTo (revision 1194416, 2015-01-22), Template:LSL Constants/NavigateTo (revision 1215210, 2023-10-28) and Template:LSL Function/position (revision 1169387, 2012-06-18), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llNavigateTo/
