---
title: setViewpoint
slug: viewer-3d/methods/setViewpoint
docTags: 
createdAt: 2024-03-01T14:17:48.685Z
---

Sets the **Viewpoint**.

:::hint{type="info"}
The **Viewpoint** simulates the position of a camera looking at the scene.
:::

## Example

::codepen{url="https://codepen.io/Catenda/embed/MWMvmZm"}

## Usage

**Named Viewpoint**

```javascript
const namedViewpoint = "front";

viewer3d.setViewpoint(namedViewpoint);
```

**Orthogonal Viewpoint**

```javascript
const orthogonalViewpoint = {
  type: "orthogonal",
  location: {
    x: 0,
    y: 0,
    z: 0
  }
};

viewer3d.setViewpoint(orthogonalViewpoint);
```

**Perspective Viewpoint**

```javascript
const perspectiveViewpoint = {
  type: "perspective",
  location: {
    x: 0,
    y: 0,
    z: 0
  }
};

viewer3d.setViewpoint(perspectiveViewpoint);
```

## Parameters

### viewpoint

The viewpoint to set.

| **Type**         | **Required** |
| ---------------- | ------------ |
| String or Object | Yes          |

**Named Viewpoint**

Valid values are:

- `home`
- `front`
- `back`
- `left`
- `right`
- `top`
- `bottom`

**Orthogonal Viewpoint**

| **Name**           | **Type**                                | **Required** | **Description**                                     |
| ------------------ | --------------------------------------- | ------------ | --------------------------------------------------- |
| `aspectRatio`      | Number                                  | No           | Aspect ratio of the camera                          |
| `direction`        | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | No           | Direction of the camera                             |
| `location`         | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | Yes          | Location of the camera                              |
| `type`             | String                                  | Yes          | Value must be `orthogonal`                          |
| `up`               | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | No           | Normalized vector describing the camera orientation |
| `viewToWorldScale` | Number                                  | No           | The scale factor between the camera and the scene   |

**Perspective Viewpoint**

| **Name**      | **Type**                                | **Required** | **Description**                                     |
| ------------- | --------------------------------------- | ------------ | --------------------------------------------------- |
| `aspectRatio` | Number                                  | No           | Aspect ratio of the camera                          |
| `direction`   | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | No           | Direction of the camera                             |
| `fov`         | Number                                  | No           | Field of view of the camera                         |
| `location`    | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | Yes          | Location of the camera                              |
| `type`        | String                                  | Yes          | Value must be `perspective`                         |
| `up`          | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | No           | Normalized vector describing the camera orientation |

