> For the complete documentation index, see [llms.txt](https://mindcodeinteractive.gitbook.io/easy-build-system/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mindcodeinteractive.gitbook.io/easy-build-system/reference/building-controller/building-view.md).

# Building View

Defines how the building system casts rays into the scene based on the active camera perspective. Supports First Person, Third Person, Top Down, and Orbital views.

***

### How Views Work

Each view handles raycasting, snap detection, and placement distance validation for its camera type. The active view is selected by the [Building Controller](/easy-build-system/reference/building-controller.md) and can be switched at runtime.\
All views share the same base settings for raycast distance, layers, snap radius, and distance limits.

***

### Built-in Views

#### First Person View

Casts a ray forward from the camera center.\
Best for first-person controllers where the player aims with the camera directly.

#### Third Person View

Casts a ray from a configurable offset relative to the camera.\
Best for over-the-shoulder perspectives where the cursor is centered but the camera is behind the player.

#### Top Down View

Raycasts from the mouse position through the camera.\
Best for top-down or isometric perspectives where the player clicks to place.

#### Orbital View

Casts a ray from a rotating orbit point around the player.\
Best for camera setups that orbit freely around a target.

***

### Creating Custom Views

Inherit from `BuildingView` and implement `GetRay()`:

```csharp
using UnityEngine;
using MindCodeInteractive.EasyBuildSystem.Framework.Code.Runtime.Systems.Controllers.Views.Abstracts;

public class MyCustomView : BuildingView
{
    public override BuildingViewType ViewType => BuildingViewType.FirstPerson;

    public override Ray GetRay()
    {
        // Return a ray from your custom camera setup
        return new Ray(transform.position, transform.forward);
    }
}
```

***

### Scripting Examples

Get the active view:

```csharp
BuildingView view = BuildingController.Instance.ActiveView;
```

Switch view at runtime:

```csharp
BuildingController.Instance.SetView(BuildingViewType.ThirdPerson);
```

Get the current ray:

```csharp
Ray ray = BuildingController.Instance.ActiveView.GetRay();
```

Check if a position is within valid distance:

```csharp
bool valid = BuildingController.Instance.ActiveView.IsWithinValidDistance(position);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mindcodeinteractive.gitbook.io/easy-build-system/reference/building-controller/building-view.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
