Hi all
I would like to have in my scene the possibility to move an object by dragging it with the mouse.
I have implemented this by listening the MouseEvent3D.MOUSE_MOVE.
Basically, I did something like this :
aDraggableMesh:Mesh;
aDragableObject.addEventListener(MouseEvent3D.MOUSE_MOVE , onMeshMouseMove);
private function onMeshMouseMove(event:MouseEvent3D):void{
// To move the mesh along the X axis only
aDraggableMesh.x = event.scenePosition.x;
}
The problem with this is that the mouse cursor has to stay over the mesh i want to drag.
If the mouse moves quickly and the cursor leaves the object, the onMeshMouseMove listener is’nt trigerred anymore and the drag stop.
How can I ensure that when a drag has started, it will continue till the mouse button is down, even if the mouse cursor leave the object?