> For the complete documentation index, see [llms.txt](https://gley.gitbook.io/mobile-traffic-system/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gley.gitbook.io/mobile-traffic-system/complete-api/setcamera.md).

# SetCamera

### Description

Update the active camera that is used to remove vehicles when are not in view.

### Declaration&#x20;

```csharp
public static void SetCamera(Transform activeCamera)
```

### Parameters

<table><thead><tr><th width="188">Name</th><th>Description</th></tr></thead><tbody><tr><td><strong>activeCamera</strong></td><td>Camera that follows the player or the player itself. Used to determine the line of sight for vehicle instantiations.</td></tr></tbody></table>

### Example

```csharp
using Gley.TrafficSystem;
using UnityEngine;

public class Test : MonoBehaviour
{
    //a reference to vehicle pool and player assigned in inspector
    public VehiclePool vehiclePool;
    public Transform player;

    //a reference to some camera
    public Transform someCamera;

    void Start()
    {
        API.Initialize(player, 20, vehiclePool);
    }

    //called at the right time
    public void UpdateCamera()
    {
        API.SetCamera(someCamera);
    }
}
```
