# Drag object in a direction

**URL:** <https://discourse.threejs.org/t/drag-object-in-a-direction/35540>\
**Category:** Questions\
**Tags:** drag, geometry\
**Created:** [March 3, 2022, 8:43pm UTC](https://discourse.threejs.org/t/drag-object-in-a-direction/35540 "2022-03-03T20:43:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![FrostyTheSouthernSnowman](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/frostythesouthernsnowman/32/24686_2.png) [@FrostyTheSouthernSnowman](https://discourse.threejs.org/u/FrostyTheSouthernSnowman)\
**Post date:** [March 3, 2022, 8:43pm UTC](https://discourse.threejs.org/t/drag-object-in-a-direction/35540/1 "2022-03-03T20:43:21Z")

</div>

I have an arrowhelper that I would like to be able to drag in the direction that it is pointing. I am running into issues with converting between pixels and positions. My current code is:

```javascript

function initDragObjectAlongAxis() {

    console.log("init")

    window.addEventListener('mousemove', dragObjectAlongAxis, false);

    window.addEventListener('mouseup', stopDragObjectAlongAxis, false);

}

function dragObjectAlongAxis(e) {

    console.log("drag")

    object.position.z = e.clientY - objectHeight;

}

function stopDragObjectAlongAxis(e) {

    console.log("stop")

    window.removeEventListener('mousemove', dragObjectAlongAxis, false);

    window.removeEventListener('mouseup', stopDragObjectAlongAxis, false);

}

```

initDragObjectAlongAxis() is called from my raycaster. I have not used drag-controls because I need to be able to drag all three dimensions. I am new to three js and any help is appreciated.
