Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Break out object dragging control, locking to arbitrary plane #1031

holmanelias opened this Issue Jan 5, 2012 · 1 comment


2 participants

I have been working with the draggable cubes example, and while it works well as a starting point, I need a couple of additional feature that I am planning to implement, but I wanted to make sure I wasn't duplicating effort first.

Basically, I want to break out an ObjectDragControl (or whatever title makes sense) that allows one to pass in a set of objects that can be dragged, and a 3D plane upon which their relative movement will be locked. This control could be attached easily to any container and it would take care of setting up the mouse events, handle the raycasting, etc.

The draggable cubes example has some oddities, such as the fact that the reference plane is always "jumping up" to the height of the object, for reasons that are still not exactly clear to me, but if you turn that off, it stops working. I think there is an issue in that it is using Plane geometry as the plane to test, rather than doing it purely mathematically with a Plane defined by an equation, checking for the point of intersection for the ray drawn from the mouse position, and then updating the object position to move to that intersection point. So in essence, I would be adding the following:

  • ObjectDragControl - allows dragging capabilities to be added to any container.
    • Plane3D - A purely geometric plane, which can be defined with non-collinear points, or a point and a normal. It would have methods to determine where a Ray intersects it, and possibly some other utility functions.

Does that overlap with anything that currently exists? I saw the work on DragPanControls, but I think that is more to manipulate a single object rather than move an object within a scene, so I think this is fundamentally different. Questions about dragging objects seem to come up a lot in the Issue queue, so I figure this is something that would be valuable to the project as a whole.


mrdoob commented Jan 10, 2012

Interesting. So what orientation does the virtual plane get when intersecting an object?

@zz85 zz85 referenced this issue May 4, 2012


THREE.DragControls #1535

@mrdoob mrdoob closed this Sep 3, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment