# Set scene dimensions?

**URL:** <https://forum.babylonjs.com/t/set-scene-dimensions/13261>\
**Category:** Questions\
**Created:** [August 10, 2020, 4:44pm UTC](https://forum.babylonjs.com/t/set-scene-dimensions/13261 "2020-08-10T16:44:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tarrew](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tarrew/32/7417_2.png) [@Tarrew](https://forum.babylonjs.com/u/Tarrew)\
**Post date:** [August 10, 2020, 4:44pm UTC](https://forum.babylonjs.com/t/set-scene-dimensions/13261/1 "2020-08-10T16:44:51Z")

</div>

Hey,

i have the following example:  
[https://www.babylonjs-playground.com/#28YUR5#672](https://www.babylonjs-playground.com/#28YUR5#672)

When i click the button, i want a mesh to basically follow my cursor until i click somewhere.

However the scene seems to be too small. The cylinder just becomes visible when i move it near another object. So the scene seems to have approximately the size to wrap the displayed objects.  
I’d like to set the dimensions of the scene to the whole screen, so i could move my cursor anywhere.

Is it possible to somehow extend the scene dimensions to maximum size?

Thanks alot!

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [August 10, 2020, 4:51pm UTC](https://forum.babylonjs.com/t/set-scene-dimensions/13261/2 "2020-08-10T16:51:01Z")

</div>

Hey!

the scene has no size per se 🙂 You can move the camera to see a bigger part of it. But technically scene has no limit. It is just the virtual container of meshes + a point of view (the camera)

---

<div class="post-metadata">

**Author:** ![Tarrew](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tarrew/32/7417_2.png) [@Tarrew](https://forum.babylonjs.com/u/Tarrew)\
**Post date:** [August 10, 2020, 5:10pm UTC](https://forum.babylonjs.com/t/set-scene-dimensions/13261/3 "2020-08-10T17:10:06Z")

</div>

Thanks alot for the fast answer 🙂

Well, that makes sense.  
The problem seems to be within the scene.pick method then?  
I tried logging the position inside the onPointerMove function and when my cursor is far away from the existing objects, “console.log(scene.pick(scene.pointerX, scene.pointerY, null, null).pickedPoint);” will always log “null”. When my cursor is close the existing objects, then coordinates will be printed out.

Is there a way to always get the mouse position, no matter where it is on the screen? I’m kind of confused why it would give me null when its further away.

---

<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 10, 2020, 5:56pm UTC](https://forum.babylonjs.com/t/set-scene-dimensions/13261/4 "2020-08-10T17:56:01Z")

</div>

The mouse coordinates are always available in `scene.pointerX` and `scene.pointerY`.

`scene.pick` is for picking: if there’s no mesh under the mouse you won’t have any `pickedPoint`.

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [August 10, 2020, 6:07pm UTC](https://forum.babylonjs.com/t/set-scene-dimensions/13261/5 "2020-08-10T18:07:12Z")

</div>

See [https://doc.babylonjs.com/api/classes/babylon.scene#pick](https://doc.babylonjs.com/api/classes/babylon.scene#pick)

---

<div class="post-metadata">

**Author:** ![Tarrew](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tarrew/32/7417_2.png) [@Tarrew](https://forum.babylonjs.com/u/Tarrew)\
**Post date:** [August 10, 2020, 6:32pm UTC](https://forum.babylonjs.com/t/set-scene-dimensions/13261/6 "2020-08-10T18:32:37Z")

</div>

Thanks alot. I’ll look into transforming the screen coordinates to the world coordinates tomorrow then 🙂

---

<div class="post-metadata">

**Author:** ![Tarrew](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tarrew/32/7417_2.png) [@Tarrew](https://forum.babylonjs.com/u/Tarrew)\
**Post date:** [August 11, 2020, 7:53am UTC](https://forum.babylonjs.com/t/set-scene-dimensions/13261/7 "2020-08-11T07:53:41Z")

</div>

Instead of attaching the mesh to the mouse, i ended up using the PointerDragBehavior.  
I realized its more suitable for my needs and runs super smooth and nice:  
[https://tarrew.gitlab.io/masterprojekt/](https://tarrew.gitlab.io/masterprojekt/)

Thanks alot again!
