# Keeping viewport/cube in same position regardless of screen size

**URL:** <https://forum.babylonjs.com/t/keeping-viewport-cube-in-same-position-regardless-of-screen-size/42984>\
**Category:** Questions\
**Created:** [August 3, 2023, 6:04pm UTC](https://forum.babylonjs.com/t/keeping-viewport-cube-in-same-position-regardless-of-screen-size/42984 "2023-08-03T18:04:51Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [August 4, 2023, 2:08pm UTC](https://forum.babylonjs.com/t/keeping-viewport-cube-in-same-position-regardless-of-screen-size/42984/4 "2023-08-04T14:08:41Z")

</div>

You could use the same trick than here:

> [@The easiest way to create a fixed axes without ORTHOGRAPHIC\_CAMERA?](https://forum.babylonjs.com/t/the-easiest-way-to-create-a-fixed-axes-without-orthographic-camera/40158/2):
>
> Welcome aboard! You could try to use an additional orthographic camera that would only render the axis viewer: It gets the quaternion from the scene camera and uses it to correctly transform the axis of the axis viewer.

Or:

> [@Camera, maintain the meshes at the same position relative to screen during screen resize](https://forum.babylonjs.com/t/camera-maintain-the-meshes-at-the-same-position-relative-to-screen-during-screen-resize/9320/7):
>
> You can try to work in NDC space and come back to world coordinates to position your meshes: [https://playground.babylonjs.com/#F8PF6Z#2](https://playground.babylonjs.com/#F8PF6Z#2) NDC space is -1 \< x \< 1, -1 \< y \< 1, -1 \< z \< 1. So, (-1, -1, -1) coordinates correspond to the bottom-left pixel on the screen, in the near plane of the camera (z=-1). By calculating the right coordinates in this space for your boxes and projecting back to world space, the boxes will be located where you want. See the setPosition function in the PG. For th…

---

_[View the full topic](https://forum.babylonjs.com/t/keeping-viewport-cube-in-same-position-regardless-of-screen-size/42984)._
