# Prevent drag of multiple DragControls at the same time

**URL:** <https://discourse.threejs.org/t/prevent-drag-of-multiple-dragcontrols-at-the-same-time/8366>\
**Category:** Questions\
**Tags:** drag-controls\
**Created:** [July 4, 2019, 7:59am UTC](https://discourse.threejs.org/t/prevent-drag-of-multiple-dragcontrols-at-the-same-time/8366 "2019-07-04T07:59:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![whiteblackkeys](https://avatars.discourse-cdn.com/v4/letter/w/b782af/32.png) [@whiteblackkeys](https://discourse.threejs.org/u/whiteblackkeys)\
**Post date:** [July 4, 2019, 7:59am UTC](https://discourse.threejs.org/t/prevent-drag-of-multiple-dragcontrols-at-the-same-time/8366/1 "2019-07-04T07:59:06Z")

</div>

Hi all, I’m using DragControls to drag some objects, I’ve multiple DragControls since I’ve different ‘drag’ callback on different objects.

The problem is that when two elements are one behind the other in the current camera/OrbitControl settings both ‘drag’ callback are called.

I don’t want to drag an element if there’s another one in front of.  
The effect is similar to [this example](https://threejs.org/examples/?q=dragg#webgl_interactive_draggablecubes), but I cannot use one single DragControls to all the elements since I’ve different ‘drag’ callbacks…

I hope I made myself clear 🙂 Any ideas?

Thanks!!

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [July 4, 2019, 9:18am UTC](https://discourse.threejs.org/t/prevent-drag-of-multiple-dragcontrols-at-the-same-time/8366/2 "2019-07-04T09:18:16Z")

</div>

The controls are not designed to be instantiated multiple times. Why do you need different `drag` callbacks in your app? Maybe you can approach the problem differently and avoid the usage of multiple `DragControl`s.

---

<div class="post-metadata">

**Author:** ![whiteblackkeys](https://avatars.discourse-cdn.com/v4/letter/w/b782af/32.png) [@whiteblackkeys](https://discourse.threejs.org/u/whiteblackkeys)\
**Post date:** [July 4, 2019, 9:26am UTC](https://discourse.threejs.org/t/prevent-drag-of-multiple-dragcontrols-at-the-same-time/8366/3 "2019-07-04T09:26:30Z")

</div>

Ok so the best way is to use only one DragControls with one callback.

I think in the ‘drag’ callback I need to check the “type” of dragged object and perform custom logic if object is of type A, B or C…

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [July 4, 2019, 10:42am UTC](https://discourse.threejs.org/t/prevent-drag-of-multiple-dragcontrols-at-the-same-time/8366/4 "2019-07-04T10:42:22Z")

</div>

Sounds good! 👍
