# Strange sixd drag behavior on a model

**URL:** <https://forum.babylonjs.com/t/strange-sixd-drag-behavior-on-a-model/47985>\
**Category:** Questions\
**Tags:** transformnode, drag, parent\
**Created:** [February 12, 2024, 5:06pm UTC](https://forum.babylonjs.com/t/strange-sixd-drag-behavior-on-a-model/47985 "2024-02-12T17:06:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Corazone777](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/corazone777/32/32706_2.png) [@Corazone777](https://forum.babylonjs.com/u/Corazone777)\
**Post date:** [February 12, 2024, 5:06pm UTC](https://forum.babylonjs.com/t/strange-sixd-drag-behavior-on-a-model/47985/1 "2024-02-12T17:06:32Z")

</div>

Hi all,  
The sixd drag is not working correctly if the “ **root** ” mesh is given a parent I don’t know how to solve it.

> **[Babylon.js Playground](https://playground.babylonjs.com/#EXHR9J%238)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [February 12, 2024, 5:41pm UTC](https://forum.babylonjs.com/t/strange-sixd-drag-behavior-on-a-model/47985/2 "2024-02-12T17:41:57Z")

</div>

This simple PG works - [drag test | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#EXHR9J#9) . It attaches a behavior to the parentNode you have created

In your example, it seems like you are attaching to the wrong parent. I didn’t follow the code fully, but if you do this - [drag test | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#EXHR9J#10) it does work (i.e. attach to the last parent of the tree).

---

<div class="post-metadata">

**Author:** ![Corazone777](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/corazone777/32/32706_2.png) [@Corazone777](https://forum.babylonjs.com/u/Corazone777)\
**Post date:** [February 12, 2024, 6:46pm UTC](https://forum.babylonjs.com/t/strange-sixd-drag-behavior-on-a-model/47985/3 "2024-02-12T18:46:35Z")

</div>

Thank you it works much better, could you please help me with the issue of dragging child meshes when the button is pressed?  
Do i need to find the first parent of the child mesh and try to drag the whole transform node instead of the single child mesh?

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [February 12, 2024, 7:57pm UTC](https://forum.babylonjs.com/t/strange-sixd-drag-behavior-on-a-model/47985/4 "2024-02-12T19:57:27Z")

</div>

I am not entirely sure what you are trying to achieve, so it is had to answer. Are you trying to be able to drag specific parts of a mesh? Or move the entire mesh? Or both? 🙂

---

<div class="post-metadata">

**Author:** ![Corazone777](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/corazone777/32/32706_2.png) [@Corazone777](https://forum.babylonjs.com/u/Corazone777)\
**Post date:** [February 13, 2024, 10:19am UTC](https://forum.babylonjs.com/t/strange-sixd-drag-behavior-on-a-model/47985/5 "2024-02-13T10:19:00Z")

</div>

I would like to be able to drag specific parts of a mesh, the idea is when i tap on a part of a mesh, let’s say a wheel, that wheel is now dragable, and if i tap on multiple meshes in a row, they all become draggable. Thank you for all your help.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [February 13, 2024, 11:46am UTC](https://forum.babylonjs.com/t/strange-sixd-drag-behavior-on-a-model/47985/6 "2024-02-13T11:46:26Z")

</div>

I believe you should maintain the state of the pointer event(s) a little better, but this would work - [drag test | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#EXHR9J#11)  
remove the parent from the single mesh when dragging it, and then set it back when you are done with dragging

---

<div class="post-metadata">

**Author:** ![Corazone777](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/corazone777/32/32706_2.png) [@Corazone777](https://forum.babylonjs.com/u/Corazone777)\
**Post date:** [February 13, 2024, 3:27pm UTC](https://forum.babylonjs.com/t/strange-sixd-drag-behavior-on-a-model/47985/7 "2024-02-13T15:27:38Z")

</div>

Thank you very much
