Hello!
I am currently dragging objects with DragControls and I have prevented reposition of the objects in the y axis:
var dragControls = new DragControls( objects, camera, renderer.domElement);
dragControls.addEventListener( ‘dragstart’, function () {
cameraControl.enabled = false;
} );
dragControls.addEventListener( ‘dragend’, function () {
cameraControl.enabled = true;
} );
dragControls.addEventListener ( ‘drag’, function( event ){
console.log(‘drag’);
event.object.position.y = 0;
});
I’m now looking to put limits on the area the objects can be dragged around the xz plane. I’d either like to set ranges within which objects can be dragged on a particular axis e.g.:
The objects can be dragged between 50 and -50 on the x-axis, and 50 and -50 on the z axis,
or
Set a max distance from ( 0, 0, 0) that an object can be dragged e.g.:
The objects can be dragged a maximum distance of 50 from ( 0, 0, 0).
Thank you