mrdoob/three.js — Issue #1031: Break out object dragging control, locking to arbitrary plane
Author: holmanelias
Created: 2012-01-05 20:54:06+00:00
State: open

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.