> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/flatredball/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/flatredball/api/flatredball/graphics/layercamerasettings/orthogonalwidth.md).

# OrthogonalWidth

### Introduction

The OrthogonalWidth and OrthogonalHeight of a LayerCameraSettings object controls the number of units wide and high that the Layer will display. The LayerCameraSettings' Orthogonal value must be true for the OrthogonalWidth and OrthogonalHeight properties to apply.

### Orthogonal Examples

This example was initially constructed in Glue. To reproduce this:

1. Create a Screen
2. Add a Sprite to the Screen
3. Set its Texture (I used ![Redball.bmp](https://951240982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fye9Ufg3vzJxwX5Hk%2Fuploads%2Fgit-blob-30873bd99af4cc8333cf5f9be5e312df241b302a%2Fmigrated_media-Redball.png?alt=media))
4. Create a 2D Layer
5. Place the Sprite on the 2D Layer

If you run the game you should now see the Sprite rendering on the Layer:![Regular2DSpriteOnLayer.PNG](https://951240982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fye9Ufg3vzJxwX5Hk%2Fuploads%2Fgit-blob-2952fe0c6a17a7652e0aa2b0630d91a0ed2d69bf%2Fmigrated_media-Regular2DSpriteOnLayer.PNG?alt=media) We can now zoom in on this Sprite simply by adjusting the orthogonal values on the LayerCameraSettings. Since I'm using Glue I'll add the following code to my CustomInitialize for my Screen that contains the Layer:

```
// If we want to zoom in 8x, we want to make the amount
// of area that the Layer views 1/8 of what it was before.
// Therefore, we'll divide by 8:
LayerInstance.LayerCameraSettings.OrthogonalWidth /= 8;
LayerInstance.LayerCameraSettings.OrthogonalHeight /= 8;
```

Now the Sprite (and anything on the same Layer) will appear at 8x zoom:![Sprite8xzoom.PNG](https://951240982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fye9Ufg3vzJxwX5Hk%2Fuploads%2Fgit-blob-8a5c91ed830b043197fbf213a00d87ecb69042db%2Fmigrated_media-Sprite8xzoom.PNG?alt=media)

### Matching Layer to [Camera](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) coordinates

You can match the LayerCameraSettings to match the Camera by setting the OrthogonalWidth/OrthogonalHeight of the LayerCameraSettings to the Camera's OrthogonalWidth/OrthogonalHeight. This assumes that both the Layer and Camera are using orthogonal values.

```
// Assuming layer is a valid Layer
layer.LayerCameraSettings.OrthogonalWidth = Camera.Main.OrthogonalWidth;
layer.LayerCameraSettings.OrthogonalHeight = Camera.Main.OrthogonalHeight;
```

### Using Orthogonal values

Orthogonal values can be used to determine the width and height in world coordinates of the area that a Layer displays. Usually these coordinates happen to match the pixel display area as well, but it is possible for this to not be the case if destination rectangle values are set differently from orthogonal values. The following code will size a Sprite so that it is the same size as the displayed area of a Layer:

```
// Assuming mySprite is a valid Sprite
// Also assuming that myLayer is a valid Layer which has a non-null LayerCameraSettings
// This will be the case if a 2D Layer has been added to a Screen in Glue, and that Screen is active
mySprite.Width = myLayer.LayerCameraSettings.OrthogonalWidth;
mySprite.Height = myLayer.LayerCameraSettings.OrthogonalHeight;
```


---

# 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://docs.flatredball.com/flatredball/api/flatredball/graphics/layercamerasettings/orthogonalwidth.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.
