[MDX] PLEASE HELP !! Drag And Drop?

Started by
19 comments, last by Grattier 18 years, 2 months ago
Quote:Original post by kovacsp
Hi,

I don't know if you have managed picking already, in case not, then you'll find many threads on the forum about picking (like this).

After you know which object to move, then you'll have to ask yourself: which is the surface you want your object to move on? As you can imagine, a single pixel on the screen, on which you point your mouse, corresponds to an infinite number of points in 3D space, standing on the line right behind your cursor.
Once you know which surface or distance is the one, then you just intersect the ray coming from the eye, through the mouse cursor, with the your surface, and place the object there.

Hope this helps,
kp



Ok... I still have the Drop problem... I'm able to pick an object but i don't know how to Drag and drop it....

I want to move Every object together... but only if a certain object is clicked.. now I know if my object is clicked but i really dunno how to make the Drag and drop work

Advertisement
Quote:I want to move Every object together... but only if a certain object is clicked.. now I know if my object is clicked but i really dunno how to make the Drag and drop work

if you just want to move your objects in a plane, you just need to translate all the objects you want to move by the mouse offset from the previous frame. simliar process to dragging a 2d panel.
if you want to move your objects in 3d it would be more complicated.
It's in 3D... but just explain me how to move 1 object...
I really need help.... I'm working on that since 2 hours and don't understand how to do it
I Really need help please...
When you detect a mouse down, store the mouse's position and set a boolean value consisting of whether you're in the middle of a drag operation to true.
When mouse moves, if that boolean is true then translate the geometry by some function of the difference between the current mouse position and the one that you stored on mouse down.
Finally, when you detect a mouse up, you set your drag boolean to false, so that the mouse move won't move the geometry.

"Some function" in this context can mean that you map the geometry's x and y positions to those of the mouse drag vector, for example.

The same basic logic works regardless of how many dimensions the geometry is in.

Niko Suni

Yeah i'm already doing that.. except that i'm using a MouseDown instead of boolean


It's really easy to do that in 2D ... What i don't know is how to call the translation.... my world rotate and i know that the mouse moved by X,Y but how many in X,Y,Z
Quote:my world rotate and i know that the mouse moved by X,Y but how many in X,Y,Z

it depends on what kind of movement you're trying to achieve.

eg. if you had a cube sitting on a plane and you want to move the box around on the plane, you'd pick the box, then do repeated mouse-ray-intersect tests with the plane to find your new location until you let go of the mouse button.
I don't have any kind of planes.. it's free for all drag and drop... that's why i'm not able to do it...

This weekend i had no time for that but I need to find it tomorrow...

I need help please! Thanks
I can't beleive that no one can help me...

I know my Start position... my Direction vector.. My Distance

startposition + ( Distance * direction) = My starting x,y,z

I know my Destination Direction.. The only think I want to know is the Distance of the destination object...


I want a transformation matrix (translation) .. it's not hard!!! But i don't know how please help me...

This topic is closed to new replies.

Advertisement