Support - Forum aa

« Back to Support
Pre-Release 2.0 » Dragging objects using mouse

» Dragging objects using mouse

Posted on 05.30.2011 by V, Arun
Hi,
   I want to drag the flare3d objects in the scene using the mouse. That is the object need to follow the mouse while dragging until the mouse  button released.An example showing what I need is here
http://theflashstudioblog.blogspot.com/2010/10/drag-movie-clips-with-mouse.html
Thanks in advance
Arun V
|
Share this
 
Reply By Hammond, Bruce 05.30.2011
Do you plan to have your camera fixed in one place, or do you want to be able to rotate the scene?
Reply By V, Arun 05.30.2011
Hi Bruce,
    
           Ya camera is fixed at one place..Not actually rotating the scene.Did you check the example that I have shown in the previous post.In that example the image flash studio can be dragged to the desired location we want.The same way I need to drag the flare3D object to the desired position using mouse.
           
Reply By V, Arun 05.31.2011
Still issue not Solved..:(
Reply By V, Arun 06.02.2011
Hi Bruce,
             Don't u understand my issue...?please help me to solve this..:(
Reply By Hammond, Bruce 06.02.2011
I'll get to it as soon as I can.  I've got a full-time jod to deal with.
Reply By Hammond, Bruce 06.02.2011
OK, here's a demonstration... http://www.e-nimation.com/Flare/3dDrag/mouseDragging.html.
I personally don't think dragging works all that well in 3D; you can only move your object along the x- and y-axes.  I'd recommend using key commands instead.

You can download the source files here:
http://www.e-nimation.com/Flare/3dDrag/MouseDragging.zip
Reply By Hammond, Bruce 06.02.2011
In the .as file I just posted for download, lines 26 and 27 read as follows:

obj.addEventListener(MouseEvent3D.MOUSE_DOWN, mouseDownEvent);
obj.addEventListener(MouseEvent3D.MOUSE_UP, mouseUpEvent);

I suggest adding one more event listener:

obj.addEventListener(MouseEvent3D.MOUSE_OUT, mouseDownEvent);

It calls the same function as the Mouse_Up listener.  In the current files the mouse can actually slip off of the obj, but the obj will still be dragging.  This addition will prevent that.
Reply By Hammond, Bruce 06.02.2011
Damn.  The new event listener should read as follows:

obj.addEventListener(MouseEvent3D.MOUSE_OUT, mouseUpEvent);

You want it to call the MouseUpEvent function, not the MouseDownEvent function.
Reply By V, Arun 06.03.2011
Hi Bruce,
             Thank you so much for giving me a solution even at your busy time..You helping me a lot.
once again thank you so much
Reply By V, Arun 08.03.2011
Hi Bruce,
      
          This post is to clarify some doubts in dragging flare3D objects on the scene. I have attached a sample project created for this

http://dl.dropbox.com/u/36035559/Flare3DDragObject.rar

In the app, we can rotate the object using the mouse and can move by pressing and holding Spacebar and using mouse (both together) 
Logic to rotate:
selectedObject.rotateY( -Input3D.mouseXSpeed, true ); 
selectedObject.rotateAxis( -Input3D.mouseYSpeed, scene.camera.getRight(false) );

Logic to move:
selectedObject.setPosition(collisionInfo.point.x,collisionInfo.point.y,collisionInfo.point.z);

But the problem here is the virtual plane as you mentioned to move 3D objects in a 2D manner is not the plane of the screen(monitor), it is the plane of the object when it is loaded. So, because of this, the object gets zoomed in and out when the object is rotated first and then moved.

Can you please tell me how can I change the virtual plane and set it as the plane of the screen/monitor so that users can move the objects in 2D. Later we will incorporate rotating the camera also (to have top, rear or side views of the scene) and users can move it in a different plane.
12Next»Showing 10 of 19