# Camera setting wrong

**URL:** <https://forum.defold.com/t/camera-setting-wrong/72673>\
**Category:** Questions\
**Created:** [February 16, 2023, 3:52pm UTC](https://forum.defold.com/t/camera-setting-wrong/72673 "2023-02-16T15:52:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cyion](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/cyion/32/30777_2.png) [@Cyion](https://forum.defold.com/u/Cyion)\
**Post date:** [February 16, 2023, 3:52pm UTC](https://forum.defold.com/t/camera-setting-wrong/72673/1 "2023-02-16T15:52:02Z")

</div>

In the game im making im using a camera to follow the players movements. The only scripting i used was in the players script and is:

```lua
function final(self)
	msg.post(".", "release_input_focus")
	msg.post("camera", "release_camera_focus")
end

```

and

```lua
function init(self) --this function runs when the level begins
	msg.post("camera", "acquire_camera_focus")
end

```

do you know what settings i need to change in the camera to get it to follow the player in the centre of the screen?  
This is what is looks like from the build window: the player is in the bottom left of the screen out of view (the enemy npc is in the screen btw)

 ![camera](https://forum-defold-uploads.b-cdn.net/original/3X/5/4/5419e058bf1d8d068286c8db08f0066b4d0fd107.jpeg)

---

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [February 16, 2023, 4:17pm UTC](https://forum.defold.com/t/camera-setting-wrong/72673/2 "2023-02-16T16:17:03Z")

</div>

The easiest way is to follow the example:

> **[Camera](https://defold.com/examples/render/camera/)**
>
> This example shows how to use a camera component and have it follow a game object. Click to toggle between following the game object and staying stationary.

There’s nothing stopping you from attaching camera component as a child to player’s game object if you would like a very strict, immediate following 😉 In the example it is dynamic (you are setting parent on message “follow”), but I usually attach it simply in the game’s collection hierarchy even

---

<div class="post-metadata">

**Author:** ![Cyion](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/cyion/32/30777_2.png) [@Cyion](https://forum.defold.com/u/Cyion)\
**Post date:** [February 16, 2023, 4:27pm UTC](https://forum.defold.com/t/camera-setting-wrong/72673/3 "2023-02-16T16:27:14Z")

</div>

I just ended up using a camera object under the player object and attached the camera file. I then set the x and y coordinated to 1/2 of the display size. It somehow worked lol
