# CreateLocation(Vector3, NavNode)

> Constructs a valid NavLocation from a position and a navigation node.

## Definition

* **Type:** Method
* **Namespace:** [Unity.AI.Navigation.LowLevel](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel.md)
* **Assembly:** UnityEngine.AIModule

```csharp
public readonly NavLocation CreateLocation(Vector3 position, NavNode node)
```

### Parameters

**** (\[Vector3]\(/engine/6000.5/script-reference/unityengine/vector3)): The world position of the [NavLocation](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navlocation.md) to create.**** (\[NavNode]\(/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navnode)): The valid identifier of the NavMesh node.

### Returns

| Type                                                                                       | Description                                                                                        |
| ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |
| [NavLocation](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navlocation.md) | An object that contains the specified NavMesh node, if valid, and a position located on that node. |

### Remarks

When the specified node is a [polygon](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navnodetype/polygon.md), the returned position is the point on the surface of the polygon that is closest to the specified position.

When the specified node is a [link](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navnodetype/link.md), the returned position is the point on the link's end segments that is closest to the specified position. The position lies on the contact line between that segment of the link and a NavMesh surface.

**Important**: The returned position isn't aligned vertically to the HeightMesh, if one exists.

To obtain reliable positions on the NavMesh, you can also use [NavWorld.MapLocation](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navworld/maplocation.md), [NavWorld.MoveLocation](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navworld/movelocation.md), and [NavWorld.GetPortalPoints](/engine/6000.5/script-reference/unity/ai/navigation/lowlevel/navworld/getportalpoints.md).

### Examples

```csharp
using UnityEngine;
using Unity.AI.Navigation.LowLevel;

public class CreateLocationExample : MonoBehaviour
{
    void Update()
    {
        using NavWorld world = NavWorld.GetDefaultWorld();

        // Map a world position to obtain a valid NavNode for the current polygon.
        NavLocation mapped = world.MapLocation(transform.position, Vector3.one, 0);
        if (!world.IsValid(mapped))
            return;

        // Re-create a location at a different point that lies on the same polygon.
        Vector3 offset = transform.position + new Vector3(0.5f, 0f, 0f);
        NavLocation custom = world.CreateLocation(offset, mapped.node);

        Debug.DrawLine(transform.position, custom.position, Color.cyan);
    }
}
```
