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:
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.