Is this line giving you the correct 2d coordinates when you drop an
object:?
view3D.findHit(view3D.session , view3D.mouseX , view3D.mouseY);
Have you tried doing something like this? (untested)
private function _onDragDrop(e:DragEvent):void {
view3D.findHit(view3D.session , view3D.mouseX ,
view3D.mouseY);
view3D.fireMouseEvent(MouseEvent3D.MOUSE_UP, view3D.mouseX,
view3D.mouseY);
var evt:MouseEvent3D =
view3D.getMouseEvent(MouseEvent3D.MOUSE_UP);
// the rest of your code
}
On Apr 13, 12:06 pm, devlander <[email protected]> wrote:
> This is actually exactly the way I implemented my drag&drop feature
> (from an image list to an UIComponent parent of my View3D).
>
> This issue seems to be related to the way Flex handles the
> UIComponents events while dragging ( none of the MouseEvent and
> MouseEvent3D events are dispatched - only DragEvent., DragOver).
>
> Unless I investigate what is going on in the flex DragManager I have
> to figure out what face3D is hit when dropping my image.
>
> My problem is that the combination of view3D.findHit() +
> view3D.getMouseEvent() does not give the right result ( the picked
> face seems to be random even when dropping at the same place).
>
> So do you have any clue on how virtual picking can be done in away3D ?
> Maybe the person who implemented the View3D class can help me on that.
>
> Thanks again for your precious help.
>
> On Apr 13, 3:11 pm, savagelook <[email protected]> wrote:
>
>
>
> > You mentioned that Flex blocks other mouse events while dragging and
> > dropping. I can't confirm whether or not that is true, but I have an
> > idea of what you can try. Are you implementing the drag and drop
> > using the "drag" properties? Like dragEnabled, dropEnabled, dragOver,
> > etc...? If you are, perhaps these convenience versions of drag and
> > drop do not fit your needs. You may need to implement drag and drop
> > yourself so that you can have full access to the "mouse up" and "mouse
> > down" events during the process. Here's a link detailing how to roll
> > your own drag and drop in Flex, which will in turn let you have more
> > control over the mouse events and likely let you get the scene
> > coordinates you are looking for:
>
> >http://www.switchonthecode.com/tutorials/simple-flex-drag-and-drop
>
> > On Apr 12, 6:59 pm, devlander <[email protected]> wrote:
>
> > > Hello,
>
> > > I am having an issue when using the flex drag/drop feature to drop an
> > > image on a mesh (3DS model).
>
> > > The problem is that while dragging all the mouse events seem to be
> > > disabled ( the flex UIComponents below mouse do not throw a MouseOver
> > > event / same for MouseEvent3D)
>
> > > So I have tried to retrieve the 3D picking point at drop time on my
> > > mesh:
> > > (note: I had to modify the View3D class to force _mouseIsOverView
> > > param to true when DragEnter inside my view3D UIContainer )
>
> > > private function _onDragDrop(e:DragEvent):void {
>
> > > view3D.findHit(view3D.session , view3D.mouseX , view3D.mouseY);
> > > var evt:MouseEvent3D =
> > > view3D.getMouseEvent(MouseEvent3D.MOUSE_UP);
>
> > > ...... create 3D image at picking point here (evt.sceneX ,
> > > evt.sceneY , evt.sceneZ)
>
> > > }
>
> > > Unfortunately the picking points I am getting are totally wrong and do
> > > not return the Face that was picked.
>
> > > So is there a specific way to perform a "virtual" picking over a
> > > specific mesh ?
>
> > > Thanks a lot for any help.