# How to set an object'a position relative to screen?

**URL:** <https://phaser.discourse.group/t/how-to-set-an-objecta-position-relative-to-screen/6019>\
**Category:** Phaser 3\
**Created:** [April 21, 2020, 1:33pm UTC](https://phaser.discourse.group/t/how-to-set-an-objecta-position-relative-to-screen/6019 "2020-04-21T13:33:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nemesis](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@Nemesis](https://phaser.discourse.group/u/Nemesis)\
**Post date:** [April 21, 2020, 1:33pm UTC](https://phaser.discourse.group/t/how-to-set-an-objecta-position-relative-to-screen/6019/1 "2020-04-21T13:33:49Z")

</div>

Hi everyone, I wanted to add a rectangle on the screen, so that it is in the middle of the screen(not the scene). I tried using normal positions first. But it didn’t work, so I tried camera relative positions but it seems that camera’s X and Y don’t go below zero. Can anyone help me with this?

In the screenshot, `X ` stands for CameraX, `Y` stands for CameraY and `CX` and `CY` stand for camera centerX and centerY respectively.

 ![screenshot3](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/0/0b451b08bb2046829c1e983c22a044e547a1996b.png)

---

<div class="post-metadata">

**Author:** ![Telinc1](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/telinc1/32/60_2.png) [@Telinc1](https://phaser.discourse.group/u/Telinc1)\
**Post date:** [April 21, 2020, 1:51pm UTC](https://phaser.discourse.group/t/how-to-set-an-objecta-position-relative-to-screen/6019/2 "2020-04-21T13:51:11Z")

</div>

The camera’s `x`/`y` and `centerX` / `centerY` properties are the on-screen position of its viewport. The location of the world at which it’s looking is in the `scrollX` and `scrollY` properties.

If you want to fix an object to the camera set its scroll factor to 0 with `setScrollFactor(0)`. For more substantial objects, it might be a better idea to use a separate scene.

---

<div class="post-metadata">

**Author:** ![Nemesis](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@Nemesis](https://phaser.discourse.group/u/Nemesis)\
**Post date:** [April 21, 2020, 11:00pm UTC](https://phaser.discourse.group/t/how-to-set-an-objecta-position-relative-to-screen/6019/3 "2020-04-21T23:00:18Z")

</div>

Thanks, that helped a lot!
