# SetLookAtPosition(Vector3)

> Sets the look at position for a character during animations.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.6/script-reference/unityengine.md)
* **Assembly:** UnityEngine.AnimationModule

```csharp
public void SetLookAtPosition(Vector3 lookAtPosition)
```

### Parameters

**** (\[Vector3]\(/engine/6000.6/script-reference/unityengine/vector3)): The position in the world space to look at.

### Remarks

Use this method in conjunction with [Animator.SetLookAtWeight](/engine/6000.6/script-reference/unityengine/animator/setlookatweight.md) to determine how strongly the character should look toward the specified position.

You can only call [Animator.SetLookAtPosition](/engine/6000.6/script-reference/unityengine/animator/setlookatposition.md) from the [MonoBehaviour.OnAnimatorIK](/engine/6000.6/script-reference/unityengine/monobehaviour/onanimatorik.md) or [StateMachineBehaviour.OnStateIK](/engine/6000.6/script-reference/unityengine/statemachinebehaviour/onstateik.md) callback. If called from a different context, this method has no effect and issues a warning.

Additional Resources: [Animator.SetLookAtWeight](/engine/6000.6/script-reference/unityengine/animator/setlookatweight.md), [MonoBehaviour.OnAnimatorIK](/engine/6000.6/script-reference/unityengine/monobehaviour/onanimatorik.md), [StateMachineBehaviour.OnStateIK](/engine/6000.6/script-reference/unityengine/statemachinebehaviour/onstateik.md).

### Examples

```csharp
using UnityEngine;

[RequireComponent(typeof(Animator))]
public class SetLookAtPositionExample : MonoBehaviour
{
    // The target to look at
    public Transform target;

    // The weight of the look at. This will determine how much the character will look at the target
    [Range(0, 1)]
    public float weight = 1f;

    Animator m_Animator;

    void Awake()
    {
        m_Animator = GetComponent<Animator>();

        if (target == null)
        {
            Debug.LogError("Target is not set. Please set the target to look at.");
        }
    }

    void OnAnimatorIK(int layerIndex)
    {
        if (m_Animator == null || target == null)
        {
            return;
        }

        // Set the look at weight
        m_Animator.SetLookAtWeight(weight);

        // Set the look at position to the target's position
        m_Animator.SetLookAtPosition(target.position);
    }
}
```
