Moving Objects with Mouse Drag

Hi,

I’m attempting to move the 3D objects in our visualization app using mouse drag. Picking the object is take care of using ray intersection but I then want to drag the mouse and move the picked object appropriately. The object only needs to be moved along x,y as its z will remain constant in this case.

Currently, I’m implementing this by creating a ray that intersects the world coordinates that correspond with the mouse coordinates and then getting the intersection point of that ray with a plane whose normal is (0, 0, 1). I then use this point to translate the object appropriately. It seems like this scheme should work but was wondering if anyone else had other suggestions.

Nick