# TCastleViewport.PositionFromWorld utility, to adjust UI position to something in 3D viewport, or measure 3D size on screen

**URL:** <https://forum.castle-engine.io/t/tcastleviewport-positionfromworld-utility-to-adjust-ui-position-to-something-in-3d-viewport-or-measure-3d-size-on-screen/529>\
**Category:** News\
**Created:** [February 19, 2022, 3:47am UTC](https://forum.castle-engine.io/t/tcastleviewport-positionfromworld-utility-to-adjust-ui-position-to-something-in-3d-viewport-or-measure-3d-size-on-screen/529 "2022-02-19T03:47:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)\
**Post date:** [February 19, 2022, 3:47am UTC](https://forum.castle-engine.io/t/tcastleviewport-positionfromworld-utility-to-adjust-ui-position-to-something-in-3d-viewport-or-measure-3d-size-on-screen/529/1 "2022-02-19T03:47:25Z")

</div>

| [![PositionFromWorld demo](https://castle-engine.io/wp/wp-content/uploads/2022/02/Zrzut-ekranu-z-2022-02-19-04-27-10-200x118.png)](https://castle-engine.io/wp/wp-content/uploads/2022/02/Zrzut-ekranu-z-2022-02-19-04-27-10.png "PositionFromWorld demo") |

New method `TCastleViewport.PositionFromWorld` allows to map a viewport (3D) position into user interface (2D) position. This allows to:

1. Place UI element exactly where some 3D thing is. 

2. Measure the (potential) size of 3D element on the screen. In turn, this allows to transform 3D elements to make them look on screen in some desired way. For example, you can adjust 3D scale, to force some 3D object to have certain size on the screen, regardless of how far it is from the camera.
