# SetLookAtRotationMatrix

The SetLookAtRotationMatrix method can be used to orient a camera so it is facing an object. This method of setting the rotation matrix can be easier to work with than calculating a rotation matrix yourself to accomplish a look-at.

### Code Example

The following code can be used to have a Camera look at a moving object called myEntity. This code assumes that myEntity is a valid Entity with a Position property.

```
Camera cameraToUse = SpriteManager.Camera;
Vector3 positionToLookAt = myEntity.Position;
cameraToUse.SetLookAtRotationMatrix(positionToLookAt);
```


---

# Agent Instructions: 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:

```
GET https://docs.flatredball.com/flatredball/api/flatredball/camera/setlookatrotationmatrix.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
