# Position of entity does not change while the cursor is moving

**URL:** <https://community.cesium.com/t/position-of-entity-does-not-change-while-the-cursor-is-moving/6018>\
**Category:** CesiumJS\
**Created:** [September 5, 2017, 1:59pm UTC](https://community.cesium.com/t/position-of-entity-does-not-change-while-the-cursor-is-moving/6018 "2017-09-05T13:59:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan\_Shubin](https://avatars.discourse-cdn.com/v4/letter/i/e9c0ed/32.png) [@Ivan\_Shubin](https://community.cesium.com/u/Ivan_Shubin)\
**Post date:** [September 5, 2017, 1:59pm UTC](https://community.cesium.com/t/position-of-entity-does-not-change-while-the-cursor-is-moving/6018/1 "2017-09-05T13:59:22Z")

</div>

Hi,

I want to bind the entity position to the mouse cursor position:

&nbsp;&nbsp;&nbsp;&nbsp;\_cursoreEntity = null;  
&nbsp;&nbsp;&nbsp;&nbsp;handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);  
&nbsp;&nbsp;&nbsp;&nbsp;handler.setInputAction(function (movement) {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var cartesian = viewer.camera.pickEllipsoid(movement.endPosition, viewer.scene.globe.ellipsoid);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (\_cursoreEntity == null) {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\_cursoreEntity = \_viever.entities.add({  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;position: cartesian,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ellipsoid: {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;radii: new Cesium.Cartesian3(0.5, 0.5, 0.5),  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;material: Cesium.Color.RED  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\_cursoreEntity.position = cartesian;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;}, Cesium.ScreenSpaceEventType.MOUSE\_MOVE);

But, the entity position is updated only when the mouse movement stops. How update position of entity during mouse movement?

Cesium 1.35, Chrome

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [September 5, 2017, 3:41pm UTC](https://community.cesium.com/t/position-of-entity-does-not-change-while-the-cursor-is-moving/6018/2 "2017-09-05T15:41:39Z")

</div>

Hi there,

If you check out our [Picking example in Sandcastle](https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Picking.html&label=Showcases), we do something very similar to what you describe with a label entity. It updates during mouse movement, so hopefully you can find a way to implement your desired behavior in that example.

Thanks!

Gabby

---

<div class="post-metadata">

**Author:** ![Ivan\_Shubin](https://avatars.discourse-cdn.com/v4/letter/i/e9c0ed/32.png) [@Ivan\_Shubin](https://community.cesium.com/u/Ivan_Shubin)\
**Post date:** [September 5, 2017, 6:45pm UTC](https://community.cesium.com/t/position-of-entity-does-not-change-while-the-cursor-is-moving/6018/3 "2017-09-05T18:45:11Z")

</div>

Thank you. Instead ellipsoid I used billboard after that an entity slides behind the cursor when moving.

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [September 6, 2017, 8:35pm UTC](https://community.cesium.com/t/position-of-entity-does-not-change-while-the-cursor-is-moving/6018/4 "2017-09-06T20:35:17Z")

</div>

Awesome, glad it helped!
