# LookAt

> Create a "look at" matrix.

## Definition

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

## LookAt(Vector3, Vector3, Vector3)

Create a "look at" matrix.

```csharp
public static Matrix4x4 LookAt(Vector3 from, Vector3 to, Vector3 up)
```

### Parameters

**** (\[Vector3]\(/engine/6000.6/script-reference/unityengine/vector3)): The source point.**** (\[Vector3]\(/engine/6000.6/script-reference/unityengine/vector3)): The target point.**** (\[Vector3]\(/engine/6000.6/script-reference/unityengine/vector3)): The vector describing the up direction (typically [Vector3.up](/engine/6000.6/script-reference/unityengine/vector3/up.md)).

### Returns

| Type                                                                  | Description                          |
| --------------------------------------------------------------------- | ------------------------------------ |
| [Matrix4x4](/engine/6000.6/script-reference/unityengine/matrix4x4.md) | The resulting transformation matrix. |

### Remarks

Given a source point, a target point, and an up vector, computes a transformation matrix that corresponds to a camera viewing the target from the source, such that the right-hand vector is perpendicular to the up vector.

The resulting matrix corresponds to `Matrix4x4.TRS(from, Quaternion.LookRotation(to-from, up), Vector3.one)`.

Additional Resources: [Matrix4x4.TRS](/engine/6000.6/script-reference/unityengine/matrix4x4/trs.md), [Quaternion.LookRotation](/engine/6000.6/script-reference/unityengine/quaternion/lookrotation.md), [Camera.worldToCameraMatrix](/engine/6000.6/script-reference/unityengine/camera/worldtocameramatrix.md), [CommandBuffer.SetViewMatrix](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/setviewmatrix.md).

## LookAt(Vector3, Vector3, Vector3)

Create a "look at" matrix.

```csharp
public static Matrix4x4 LookAt(in Vector3 from, in Vector3 to, in Vector3 up)
```

### Parameters

**** (\[Vector3]\(/engine/6000.6/script-reference/unityengine/vector3)): The source point.**** (\[Vector3]\(/engine/6000.6/script-reference/unityengine/vector3)): The target point.**** (\[Vector3]\(/engine/6000.6/script-reference/unityengine/vector3)): The vector describing the up direction (typically [Vector3.up](/engine/6000.6/script-reference/unityengine/vector3/up.md)).

### Returns

| Type                                                                  | Description                          |
| --------------------------------------------------------------------- | ------------------------------------ |
| [Matrix4x4](/engine/6000.6/script-reference/unityengine/matrix4x4.md) | The resulting transformation matrix. |

### Remarks

Given a source point, a target point, and an up vector, computes a transformation matrix that corresponds to a camera viewing the target from the source, such that the right-hand vector is perpendicular to the up vector.

The resulting matrix corresponds to `Matrix4x4.TRS(from, Quaternion.LookRotation(to-from, up), Vector3.one)`.

Additional Resources: [Matrix4x4.TRS](/engine/6000.6/script-reference/unityengine/matrix4x4/trs.md), [Quaternion.LookRotation](/engine/6000.6/script-reference/unityengine/quaternion/lookrotation.md), [Camera.worldToCameraMatrix](/engine/6000.6/script-reference/unityengine/camera/worldtocameramatrix.md), [CommandBuffer.SetViewMatrix](/engine/6000.6/script-reference/unityengine/rendering/commandbuffer/setviewmatrix.md).
