# Move Box with line end

**URL:** <https://forum.babylonjs.com/t/move-box-with-line-end/3709>\
**Category:** Questions\
**Created:** [June 5, 2019, 8:49am UTC](https://forum.babylonjs.com/t/move-box-with-line-end/3709 "2019-06-05T08:49:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lulzwoot](https://avatars.discourse-cdn.com/v4/letter/l/e36b37/32.png) [@lulzwoot](https://forum.babylonjs.com/u/lulzwoot)\
**Post date:** [June 5, 2019, 8:49am UTC](https://forum.babylonjs.com/t/move-box-with-line-end/3709/1 "2019-06-05T08:49:29Z")

</div>

Hey everybody,

i am fairly new to babylonjs and currently working on my first project, trying to bring the ngrx store and babylonjs together. As you can prolly imagine there are a lot of questions to be asked … but for now i will stick to this one 😉 :

Lets say i have 2 Boxes. The boxes are connected by a line, that can have numerous points. At the moment the boxes as well as the line are independant meshes. Now if i move one box, i want the corresponding line end to move with my box. What i am roughly thinking about is something like:

- Click on the box
- Have something like a MeshManager to find all Meshes that have to move with my box
- Move the box\*
- update the points array of the line while dragging the box around
- when drag ends, dispatch an action to my store to update the domain model

- What would i ideally use to move my Box? The PositionGizmo or a mesh behavior? Are there more behaviors to come in future releases?

But: this feels rather complicated for something that i would consider a fairly common use case. I ve read about the TransformNode but that doesnt seem to help me with my problem since i dont want to move the complete line mesh.

A small and simple Playground using the gizmo to move the box around: [https://www.babylonjs-playground.com/#4TMPFR#1](https://www.babylonjs-playground.com/#4TMPFR#1)

Best regards and thanks in advance!

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [June 5, 2019, 12:13pm UTC](https://forum.babylonjs.com/t/move-box-with-line-end/3709/2 "2019-06-05T12:13:03Z")

</div>

Your approach is correct and you will need to update the line. This is a pretty common use case in 2d with node editors but a bit less in 3d. There would be a lot of ways to update the line depending on the underlying use case.

You could also have a look at the dragbehavior to move the box: [Use Mesh Behaviors (eg. dragging) - Babylon.js Documentation](https://doc.babylonjs.com/how_to/meshbehavior)
