> 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/camera/forceupdatedependencies.md).

# ForceUpdateDependencies

### Introduction

The ForceUpdateDependencies for the Camera performs all of the same functionality as the [PositionedObject's ForceUpdateDependencies](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) call, but it also does a few extra things. Specifically, it updates the mins and maxes of the camera, and recalculates its View and Project matrices. For information on ForceUpdateDependencies as it relates to [PositionedObjects](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) in general, see the [PositionedObject's ForceUpdateDependencies](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) page.

### When to call Camera.ForceUpdateDepenencies

If you are writing a game where you need to perform logic based off of the Camera's position or edge values, then you need to call ForceUpdateDependencies prior to asking the Camera for any of these values **if the Camera is attached to another object**. Games often need to know a Camera's position in custom code. Consider the following examples:

1. You may be developing a top-down game which shows arrows on the edge of the screen to indicate where off-screen enemy units are located. The positioning of these units requires math using the Camera's position.
2. The calculation of the visible [Sprites](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) in a [SpriteGrid](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) requires up-to-date Camera position values.
3. Your game may be a 3D game which uses a 2D [Layer](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) for HUD. The 2D elements in your game may be based off of the 3D position of elements in the world (this is a more complex case).

If your Camera is attached to another object, you will need to call ForceUpdateDependencies to make sure that all values are up-to-date.

### Order of calls

The order of calls matters in your game. The following code gives an example of how you would want to structure your Screen's CustomActivity if you plan on using the Camera's positioning:

```
void CustomActivity(bool firstTimeCalled)
{
    // First we perform any logic that may modify the Camera's position
    // If your Camera-modifying position is being done in an Entity, and
    // if that Entity is part of the Screen and you are using Glue, then the
    // Entity's CustomActivity will have already been called for the frame by
    // the time the Screen's CustomActivity is called.  Therefore, by this point
    // the only code that will modify the Camera will be in any Custom code you call
    CameraPositionModifyingLogic();
    
    SpriteManager.Camera.ForceUpdateDependencies();
   
    LogicThatDependsOnTheCamerasPosition();
    
}
```

### View and Project matrices

As mentioned above, if you are translating between 3D and 2D coordiantes, you may still need to call ForceUpdateDepencies even if you are only updating the Camera's position manually. The reason for this is because you may end up using the Camera's matrices for calcualting the translations, and these are only updated when the Camera's dependencies are updated. Therefore, if you are experiencing unexpected behavior when translating between 3D and 2D (or 2D and 3D), then you should try calling ForceUpdateDependencies.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flatredball.com/flatredball/api/flatredball/camera/forceupdatedependencies.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
